C - 1 Producer 2 Consumer problem?
-
I know how to solve the 1 producer 1 consumer problem. It was something like this. The producer produced 1 item and stored it into the buffer. The producer blocks until the consumer ...show more
-
Answer:
This problem isn't particularly interesting in C. It only becomes interesting in the context of some operating system environment where threads or processes exist in the face of pre-emptive switching. I've no idea what calls you are permitted to make here. Are you implementing a "lock" using a binary semaphore? I don't know. Also, the design you provided doesn't seem workable. Suppose producer grabs 'mutex' and then sits waiting on 'parent' to be notified/signaled. The consumer can't get mutex, so it can't signal. What you have looks like half of a monitor-based system. But I don't see the monitor. See link below for a reasonable discussion here.
D2NBZS7UNNDCTCPIZPQHRJ7UUQ at Yahoo! Answers Visit the source
Related Q & A:
- What is the problem with pointers in c?Best solution by Stack Overflow
- Should I take the SAT Math Level 1 or 2 or both?Best solution by collegeprep360.com
- There was a problem accessing your account. Please try again in a moment. Error #1?Best solution by Yahoo! Answers
- How do you multiple 1 2/3 by 3 1/8?Best solution by themathpage.com
- Modern Warfare 2 PC problem?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.