I'm currently studying how producer/consumer process works. Here we are given the following shared data structures, mutex, empty, and full. We have the codes for the producer, consumer, wait, and signal.
Below those code is my assumption. I try to explain the logic behind both the producer and consumer process. What I don't understand is why do we need the semaphore mutex? Is it so that only 1 process is able to consume from the buffer at a time?