🍴 Dining Philosophers Deadlock Simulator
An interactive 3D round table of philosophers and forks where toggling locking strategies shows how naive resource acquisition causes deadlock and how ordering avoids it.
Five (or more) philosophers sit at a round table, alternating between thinking and eating, but each needs both the fork to their left and the fork to their right — shared resources that can trigger deadlock or starvation depending on how they're acquired.
🔬 What It Demonstrates
Naive "grab left, then right" locking lets every philosopher seize one fork and wait forever for the next — a circular wait that freezes the whole table red. Resource ordering and a waiter/arbitrator strategy both break that cycle and keep meals flowing.
🎮 How to Use
Pick a locking strategy, adjust the number of philosophers and simulation speed, and watch fork colour and philosopher state (grey/yellow/green/red) evolve live. Reset the table to try a fresh run under the same strategy.
💡 Did You Know?
Deadlock needs four conditions at once — mutual exclusion, hold-and-wait, no preemption, and circular wait. Breaking just one, as resource ordering does, makes deadlock structurally impossible regardless of scheduling luck.
Interactive 3D round table of philosophers and forks where toggling locking strategies shows how naive resource acquisition causes deadlock and how ordering avoids it.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install