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

J4 ›› 2011, Vol. 33 ›› Issue (4): 75-80.doi: 10.3969/j.issn.1007130X.2011.

• 论文 • 上一篇    下一篇

一种用于并行系统的非阻塞消息队列机制

刘晓建,吴庆波,戴华东,任怡   

  1. (国防科学技术大学计算机学院,湖南 长沙 410073)
  • 收稿日期:2009-06-04 修回日期:2009-11-05 出版日期:2011-04-25 发布日期:2011-04-25
  • 作者简介:刘晓建(1974),男,河北定州人,博士,副研究员,研究方向为操作系统和虚拟机技术。
  • 基金资助:

    国家863计划资助项目(2008AA01Z138,2007AA01Z177)

A NonBlocking List Mechanism for Event Message Communications

LIU Xiaojian,WU Qingbo,DAI Huadong,REN Yi   

  1. (School of Computer Science,National University of Defense Technology,Changsha 410073,China)
  • Received:2009-06-04 Revised:2009-11-05 Online:2011-04-25 Published:2011-04-25

摘要:

并行线程之间的消息传递和同步机制与系统的并行性能密切相关。在并行系统中,人们期望不必要的同步尽可能少,以充分开发系统的并行性,提高系统的运行效率。非阻塞缓冲区机制(NBB)允许消息生产者和消费者在不使用同步机制的情况下实现消息传递。但是,NBB机制存在着消息缓冲区有限、在多生产者和/或多消费者情况下使用不便、有时甚至功能不能满足要求等问题。本文介绍的非阻塞队列机制(NBL)可看作是NBB的链表实现,但NBL可以有效地避免NBB的上述缺陷。本文描述了相关算法及其正确性证明。最后讨论了NBL机制的使用方法,并进行了有效性和性能评测。

关键词: 并行计算, 分布式计算, 线程, 同步, 阻塞, 实时, NBB, NBL, 生产者, 消费者

Abstract:

It is desirable to facilitate data communications among parallel computation threads without incurring nonessential synchronizations in parallel computing systems. The NonBlocking Buffer(NBB) is such a mechanism. However, the NBB mechanism has several severe drawbacks, including limited buffer size, inconvenient or even infeasible usage in multiple consumers/producers cases. Nonblocking List mechanism(NBL), which can handle these problems gracefully, is described in this article. The algorithms and formal proofs are also presented. Finally, experiments are done to test the validity and performance of the NBL mechanism. The NBL mechanism can be regarded as the linked list version of NBB.

Key words: parallel programming;distributed computing;thread;synchronization;blocking;real time;NBB;NBL;producer;consumer