Buffer (capacity 5)
Producer
Idle
Consumer
Idle
Buffer: 0/5
Produced: 0
Consumed: 0
Transitions
Quick Actions
Buffer Level Over Time
Cumulative Production & Consumption
How It Works
The producer-consumer problem is a classic synchronization scenario where:
- Producer creates items and places them in a shared buffer
- Consumer takes items from the buffer and processes them
- The buffer has fixed capacity — the producer blocks when full, the consumer blocks when empty
The Petri net enforces synchronization using complementary places:
- buffer + buffer_space = capacity (always)
- Producer needs a buffer_space token to produce (blocks when full)
- Consumer needs a buffer token to consume (blocks when empty)
- This models bounded capacity without guards or inhibitor arcs
Watch the buffer chart to see how random scheduling creates utilization patterns. A balanced system keeps the buffer near 50%. An overproducing system fills the buffer and blocks; an underproducing system starves the consumer.