文件名称:ProducersAndCustomers
介绍说明--下载内容均来自于网络,请自行研究使用
通过研究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