Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
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
Posted
Updated 15-Apr-11 1:46am
v2
Comments
Manfred Rudolf Bihy 15-Apr-11 6:45am    
Ah the dank reek of homework on a Friday afternoon! :)
Dylan Morley 15-Apr-11 6:50am    
Didn't even have the courtesy to remove the question number.

Stuck on number 1), doesn't look promising
Sergey Alexandrovich Kryukov 15-Apr-11 13:28pm    
I have two main problems:
1) Bad memory,
2) ...I already forgot what.

:-)
--SA

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
 
Share this answer
 
v2
Comments
Espen Harlinn 15-Apr-11 8:22am    
Nice link, 5ed!
Manfred Rudolf Bihy 15-Apr-11 9:11am    
Thanks Espen!
Sergey Alexandrovich Kryukov 15-Apr-11 13:31pm    
Same thing? You and Yusuf can't be wrong, my 5. :-)
--SA
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.
 
Share this answer
 
v2
Comments
Manfred Rudolf Bihy 15-Apr-11 7:44am    
Sorry Yusuf, my vote of one for replicating the same link and that a quarter of an hour later. This is a no go.
Yusuf 15-Apr-11 8:59am    
Manfred,
No worries. I get that. I guess I don't like to explain myself, but let me give you anyways. When I saw the question there was no answer, then I put my answer and got distracted before I submitted. I'd to answer to call of duty. Then came back and pushed the submit button.

By all means you beat me to it and you deserve the point. I +5 your answer, please don't change your vote.

peace.
Manfred Rudolf Bihy 15-Apr-11 9:11am    
You're right of course this also has happened to me before. Vote corrected!
I didn't really think! :)
Yusuf 15-Apr-11 9:14am    
peace.
Espen Harlinn 15-Apr-11 8:22am    
Nice link, 5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900