文件名称:ProducersAndCustomers
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:4.57kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
通过研究Linux的线程机制和信号量实现生产者消费者(Bounded Buffer)问题的并发控制。
通过n个缓冲区组成缓冲池共同完成“生产和消费”任务,每个缓冲区存放一个产品,生产者将生产出的产品放入空缓冲区;消费者从满缓冲区中取出产品。一旦所有缓冲区均满时,生产者必须等待消费者提供空缓冲区。另外,对所有生产者和消费者线程来说,缓冲池是临界资源,即任何一个线程在对某个缓冲区进行“存”和“取”操作时须和其他线程互斥执行。
-By studying the Linux thread and semaphore mechanisms to achieve the producer consumer (Bounded Buffer) the issue of concurrency control. N the composition of a buffer zone through the buffer pool together, " production and consumption," the task, each buffer storing a product, producers will produce products Add empty buffer consumers out of the buffer zone from the full product. Once all the buffers are full, the producer must wait until buffer space consumers. In addition, producers and consumers of all threads, the buffer pool is a critical resource, that is, any thread of a buffer zone in the " deposit" and " check" operation to be mutually exclusive and the implementation of other threads.
通过n个缓冲区组成缓冲池共同完成“生产和消费”任务,每个缓冲区存放一个产品,生产者将生产出的产品放入空缓冲区;消费者从满缓冲区中取出产品。一旦所有缓冲区均满时,生产者必须等待消费者提供空缓冲区。另外,对所有生产者和消费者线程来说,缓冲池是临界资源,即任何一个线程在对某个缓冲区进行“存”和“取”操作时须和其他线程互斥执行。
-By studying the Linux thread and semaphore mechanisms to achieve the producer consumer (Bounded Buffer) the issue of concurrency control. N the composition of a buffer zone through the buffer pool together, " production and consumption," the task, each buffer storing a product, producers will produce products Add empty buffer consumers out of the buffer zone from the full product. Once all the buffers are full, the producer must wait until buffer space consumers. In addition, producers and consumers of all threads, the buffer pool is a critical resource, that is, any thread of a buffer zone in the " deposit" and " check" operation to be mutually exclusive and the implementation of other threads.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
ProducersAndCustomers.doc
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.