• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

J4 ›› 2008, Vol. 30 ›› Issue (12): 142-145.

• 论文 • 上一篇    下一篇

一种面向分布式系统的程序设计模式

李慧霸 彭宇行 卢锡城   

  • 出版日期:2008-12-01 发布日期:2010-05-19

  • Online:2008-12-01 Published:2010-05-19

摘要:

分布式系统的程序设计模式主要包括多线程模式和事件驱动模式,其中事件驱动模式占据了主导地位。本文讨论了这两种模式的不足,以及Coroutine模式相对它们的优点, 并认为Coroutine模式是最适合分布式系统的程序设计模式。本文在此基础上提出了Libresync,它是一个基于Coroutine模式的分布式系统基础支持库。它既能给应用开发带来非常清晰的控制流程,又具有很高的灵活性和表达力,性能也能满足大多数需求。

关键词: 分布式系统 并发 多线程 事件驱动 Coroutine

Abstract:

Programming patterns for distributed systems mainly includes multi-threaded and event-driven patterns, and the event-driven pattern is the major one.  This paper, however, discusses their disadvantages, and the Coroutine pattern's advantages over them. We think Coroutine is the most suitable pattern    for distributed system programming. And we present Libresyne, a Coroutine-based supporting library for distributed systems, which brings us clear contro  l flow, high flexibility and expressiveness. The performance of Libresync is also reasonably good enough for most purposes.

Key words: distributed system, concurrency, multi-threaded, event-driven, Coroutine