Lab › Sync › Producer-Consumer

Producer-Consumer Simulation

Bounded buffer problem with semaphore synchronization — visualize producer and consumer threads in real-time.

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)
Configuration