Producer consumer: Blocking
Use 3 mutex:
mutex = S(1) notFull = S(K) notEmpty = S(0)
We replace busy waiting here, with the
These will simply send a process to sleep, if the conditions do not hold:
- Producer: Buffer not full
- Consumer: Buffer not empty
so the process does not do busy waiting!
How do we continue on the process that when to sleep?
signal wakes up sleeping processes. This will cause the sleeping process to wake up.