Thread Synchronization Visualizer

A counting semaphore limits concurrent access to N slots. Threads decrement the count to acquire; blocked if count=0; increment on release. Here N=2 with 3 threads competing.
Speed 1x
Thread 1
Thread 2
Thread 3
Waiting (blocked)
Thread 1
T1
Thread 2
T2
Thread 3
T3
Semaphore
2
permits left
Max: 2
A mutex (mutual exclusion lock) is a binary semaphore with ownership. Only one thread holds the lock at a time; others block. Ownership ensures only the locker can unlock.
Speed 1x
Thread 1
Thread 2
Waiting for lock
Thread 1
T1
Thread 2
T2
Critical
section
empty
Mutex
🔓
Unlocked
Owner:
-
A monitor bundles a mutex with condition variables. Threads wait() on a condition (releasing the lock), and are signal()-ed when the condition may hold - classic producer/consumer pattern.
Speed 1x
Producer
Consumer
Waiting on condition
Producer
P
Consumer
C
Buffer (capacity 3)
Items: 0/3
notFull:
notEmpty:
Monitor
🔓
Unlocked
Owner:
-
Signals sent:
0