Solution traditional to producer-consumer
In Operating-Systems, as you see in the link above for producer consumer, two semaphores full and empty are used, why is it not possible to do this using only one quantity semaphore fullEmpty.
What I mean is, we have a binary semaphore mutex and another semaphore fullEmpty, which is initially 0 because there are no items in the buffer, so why do we need 2 semaphores (full, empty)?
The only thing is the order of wait and signal need to be changed so that the updating of fullEmpty is within the critical section.
Any thoughts or reasons?