The Dining Philosophers Problem
"Five philosophers share five forks, each needing both neighbours' forks to eat, and a naive protocol leaves them all stuck."
"Five philosophers share five forks, each needing both neighbours' forks to eat, and a naive protocol leaves them all stuck."
The dining philosophers problem is a classic illustration of the challenges of concurrent programming and resource allocation. Five philosophers sit around a table, with a single fork between each pair, five forks in all, and each philosopher alternates thinking and eating. To eat, a philosopher needs both the fork on their left and the one on their right, so neighbours compete for the shared forks. The problem is to devise a protocol under which every philosopher can eventually eat and none starves, while still allowing genuine concurrency. Formulated by Edsger Dijkstra, it is the canonical teaching example for deadlock, synchronisation, and the design of concurrent algorithms.
Rated Heuristic: a dependable rule of thumb, not a proven theorem. The other 224.
The problem dramatises how independent processes competing for shared resources can fail. If every philosopher simultaneously picks up their left fork and then waits for the right one, all are stuck forever, each holding one fork and waiting on a neighbour, a deadlock caused by a circular wait. Deadlock requires four conditions to hold together, the Coffman conditions: mutual exclusion, hold-and-wait, no preemption, and circular wait, and breaking any one prevents it. Dijkstra's resource-ordering solution numbers the forks and has each philosopher pick up the lower-numbered fork first, breaking the circular wait; an arbitrator, or waiter, that grants permission is another remedy, as is limiting how many philosophers may reach for forks at once.
A fully distributed solution using clean and dirty fork labels and message passing, requiring no central coordinator and working for arbitrary graphs of contending processes.
Allowing at most four philosophers to attempt to eat at once, which prevents the circular wait by ensuring at least one philosopher can always acquire both forks.
The dining philosophers problem is the standard vehicle for teaching deadlock, resource allocation, and synchronisation in operating systems and concurrent programming. It makes vivid how individually reasonable rules, each philosopher grabbing a fork and waiting, can combine into a system-wide freeze, and it is the classic setting for the Coffman conditions and the strategies that defeat deadlock, from resource ordering to arbitration. Its lessons generalise far beyond the table, to any system in which concurrent processes contend for shared, limited resources, which is why it remains a fixture of computer-science education.
The dining philosophers problem is an idealised teaching model, not a real system, and its central concern is deadlock via circular wait, with starvation and livelock as secondary issues. Simplistic fixes fail: having each philosopher put a fork down and retry can cause livelock, endless activity with no progress, and the trivial rule of letting only one philosopher eat at a time avoids deadlock but destroys the concurrency the problem exists to preserve. Its value is as a minimal illustration of concurrency hazards, from which real solutions must add care about fairness and progress.
The problem's central lesson is deadlock through circular wait, not starvation alone. Having philosophers drop and retry their forks is not a real solution, since it can produce livelock rather than progress. Letting only one philosopher eat at a time prevents deadlock but eliminates concurrency, which the problem explicitly seeks to keep. There are five shared forks, one between each adjacent pair, not one per hand. And the philosophers framing is Tony Hoare's retelling; Dijkstra's original 1965 version was about computers competing for tape drives.
Real as a rule of thumb, not as a theorem. The Dining Philosophers Problem is rated Heuristic here: dependable enough to plan with, and with no proof behind it.
Rated from two sources. 225 of the 1,116 entries carry this rating. How the scale works.
The best-known laws are the least likely to rest on measurement.
Formulated by Edsger Dijkstra in 1965 as an examination exercise about computers competing for tape drives, and given its familiar dining-philosophers framing by Tony Hoare; it is the textbook illustration of the Coffman deadlock conditions.
8 languages, as recorded on Wikidata. These are names the idea already goes by, not translations we made. The whole index by language.
Everything above traces to two pages on en.wikipedia.org: both secondary, accounts of the original rather than the original itself, which has not been located for this entry. Nothing is written from memory, and the method is written down. Spot an error or a better source? Suggest a fix.