semaphores, classic problems
semaphores, classic problems
semaphores, classic problems
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
The producer/consumer problem<br />
Producer<br />
Buffer<br />
Consumer<br />
Semaphore s = new Semaphore();<br />
cobegin<br />
/* Producer */<br />
while(true) {<br />
produce;<br />
V(s);<br />
} |<br />
/* Consumer */<br />
while(true) {<br />
P(s);<br />
consume;<br />
}<br />
coend<br />
Computing Systems<br />
http://www.cs.caltech.edu/cs134/cs134a October 10, 2001