Producer-Consumer: Producer creates items and places them in a shared buffer. Consumer takes items from the buffer. Semaphores prevent race conditions.
mutex: binary semaphore (mutual exclusion)
empty: counts empty slots (init = buffer size)
full: counts filled slots (init = 0)
Live Buffer Visualization
Producer
Waiting...
Produced: 0
Shared Buffer (0/5)
Semaphore empty: 5 |
Semaphore full: 0
Consumer
Waiting...
Consumed: 0