登录
首页 » Linux-Unix program » 在同一个进程地址空间内执行的两个线程。生产者线程生产物品,然后将物品放置在一个空缓冲区中供消费者线程消费。消费者线程从缓冲区中获得物品,然后释放缓冲区。当生产者...

在同一个进程地址空间内执行的两个线程。生产者线程生产物品,然后将物品放置在一个空缓冲区中供消费者线程消费。消费者线程从缓冲区中获得物品,然后释放缓冲区。当生产者...

于 2022-03-10 发布 文件大小:622.00 B
0 81
下载积分: 2 下载次数: 1

代码说明:

在同一个进程地址空间内执行的两个线程。生产者线程生产物品,然后将物品放置在一个空缓冲区中供消费者线程消费。消费者线程从缓冲区中获得物品,然后释放缓冲区。当生产者线程生产物品时,如果没有空缓冲区可用,那么生产者线程必须等待消费者线程释放出一个空缓冲区。当消费者线程消费物品时,如果没有满的缓冲区,那么消费者线程将被阻塞,直到新的物品被生产出来。-In the same address space of a process implemented within the two threads. The producer thread production of goods, and then items placed in an empty buffer in the thread consumption for consumers. Consumer thread to acquire items from the buffer, and then release the buffer. When the producer thread is the production of goods, if there is no empty buffers are available, then the producer thread must wait for the Consumer thread to release an empty buffer. When a consumer thread consumer goods, if the buffer is not full, then the consumer thread will be blocked until the new items were produced.

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 696522资源总数
  • 104049会员总数
  • 30今日下载