Operating systems · interactive
Producer–consumer
A producer thread makes items and a consumer thread uses them, through a shared buffer with 3 slots. The producer is faster. Without coordination they overwrite and misread; with two semaphores and a lock, each waits its turn.
Producer
···
Consumer0 corrupted operations so far
Empty buffer with 3 slots. Semaphores: empty = 3, full = 0.
Coordination
Step 2 of 4 · read left to right
In production
Tools and technologies
Blocking queues implement this pattern for you.
Not tied to one language — use these names when you search docs or design a system.