模拟生产者消费者问题的程序 [英] program to model the producer consumer problem

查看:74
本文介绍了模拟生产者消费者问题的程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1.编写一个程序来模拟生产者消费者问题.生产者具有固定的缓冲区大小,并且在缓冲区满时无法生产.另一方面,消费者的消费形式是由生产者提供的固定缓冲区大小.消费者不能从空缓冲区中消费

1. Write a program to model the producer consumer problem. The producer has a fixed buffer size and cannot produce when it is full. On the other side, the consumer consumes form a fixed buffer size that is fed by the producer. The consumer cannot consume from an empty buffer

推荐答案

在此处找到CP(通过Google热门搜索:消费者生产者C ++):
Found here on CP (via google top hit: consumer producer C++): Producer/Consumer Implementation Using Thread,Semaphore and Event[^].

No really you all just have to believe me, Google is your friend!

Cheers,

-MRB


这闻起来像作业.学习没有错,如果您愿意学习,请参阅此CP文章

使用线程,信号量和事件的生产者/消费者实现 [
This smells like a homework. There is nothing wrong in learning, if you are willing to learn see this CP articles

Producer/Consumer Implementation Using Thread,Semaphore and Event[^]

UPDATE:
I did not see when I hit the submit Manfred had beaten me to it. See my comment to him below. Manfred deserves the point not me.


这篇关于模拟生产者消费者问题的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆