Puzzles

The Dining Philosophers' Deadlock

Five philosophers sit around a circular table, alternating between thinking and eating a spaghetti dish that requires two forks. There is exactly one fork between each pair of neighbours — five forks for five philosophers — and each may only pick up the forks immediately to their left and right. If every philosopher grows hungry at the same moment and each simultaneously picks up the fork on their left, what happens to the meal, and can you design a house rule that prevents it ever happening?

Reveal the answer

If all five pick up their left fork at once, each then waits forever for the right fork, which their neighbour is holding while waiting on their own neighbour — total deadlock, everyone starving with one fork apiece. Fixes include breaking the symmetry (one philosopher picks up their right fork first instead), adding a 'waiter' who limits how many may sit at once, or imposing a strict global order in which forks must always be picked up. Edsger Dijkstra devised the underlying resource-contention problem in 1965 (originally framed as computers competing for tape drives) and gave it its classic philosophers-and-forks form in his 1971 paper 'Hierarchical Ordering of Sequential Processes' — it remains a foundational example in concurrent-programming theory.

Edsger W. Dijkstra, Hierarchical Ordering of Sequential Processes — Acta Informatica, 1971 (resource-contention version originated 1965)

One credited idea per card. No filler. Swipe the rest in Savvy.

Keep swiping — it's free Works right in your browser. No app store needed.