Dining Philosophers Deadlock Simulator (2D)
A top-down canvas table where naive, resource-ordering and waiter-arbitrator locking strategies drive the same fork-acquisition state machine as the 3D version, so you can watch a circular wait freeze the whole table.
This 2D companion drives the exact same fork-acquisition state machine as the 3D round table through a plain top-down canvas: pick naive, resource-ordering or waiter-arbitrator locking, adjust philosopher count and simulation speed, and watch seat colour track each philosopher's state (thinking/waiting/eating/deadlocked) while fork colour and hand-lines show who holds what, ending in a full-table deadlock banner whenever a circular wait forms under the naive strategy.
2D top-down dining-philosophers lab with naive, resource-ordering and waiter-arbitrator locking strategies driving a live fork state machine and deadlock detector, matching the 3D version's mechanics.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install
If every philosopher grabs their left fork first and then waits for their right, and all get hungry at once, each holds one fork while waiting on a neighbour who holds the fork they need — a circular wait that never resolves.
Every philosopher must pick up the lower-numbered fork first. The highest-numbered philosopher then reaches for a different fork first than everyone else, which breaks the circular chain and makes deadlock structurally impossible.
A central arbitrator only lets up to N−1 philosophers attempt to pick up forks at the same time, guaranteeing that at least one philosopher can always finish eating and release forks for the rest.