首页> 外文期刊>C - C++ Users Journal >Thread-Safe Circular Queue
【24h】

Thread-Safe Circular Queue

机译:线程安全循环队列

获取原文
获取原文并翻译 | 示例

摘要

Producer/consumer tasks, threads, and processes are common in operating systems. Applications of the producer/consumer problem, also known as the "bounded buffer problem," range from compilers producing assembly code consumed by assemblers, to the pi pe command implemented in the UNIX shell. In this article, I present a C++ template implementation of a bounded buffer as a circular queue. I also show how to make, the circular queue compatible with STL algorithms by providing a special iterator used as an interface between the algorithms and the circular queue. The bounded buffer problem requires: 1. Mutually exclusive access by the producer and consumer to the buffer. 2. Synchronization between the producer and consumer when the buffer is full or empty.
机译:生产者/消费者任务,线程和进程在操作系统中很常见。生产者/消费者问题(也称为“有界缓冲区问题”)的应用范围很广,从生成汇编器消耗的汇编代码的编译器到在UNIX Shell中实现的pi pe命令。在本文中,我提出了一个有界缓冲区作为循环队列的C ++模板实现。我还展示了如何通过提供一个特殊的迭代器作为算法和循环队列之间的接口,使循环队列与STL算法兼容。有界缓冲区问题要求:1.生产者和使用者对缓冲区的互斥访问。 2.当缓冲区已满或为空时,生产者和使用者之间的同步。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号