Dining Philosophers Problem
Updated 2026-07-30
Summary
The Dining Philosophers Problem is a classic problem in computer science that demonstrates issues arising in multi-threaded synchronization in concurrent computing. In 1971, Dutch computer scientist Edsger Dijkstra posed a synchronization problem involving five computers attempting to access five shared tape drives. Later, Tony Hoare reformulated it as the Dining Philosophers Problem. This problem can be used to explain deadlock and resource exhaustion.
Definition
Five philosophers sit around a table with one chopstick between each pair (five total). Each philosopher either thinks or eats. To eat, they need both left and right chopsticks. If everyone picks up the left chopstick and waits for the right, all will starve (deadlock). Scaffold use: resource competition deadlock. Metaphor for resource allocation in organizations. If everyone holds a portion of resources without releasing, waiting for others to release, the whole organization becomes paralyzed (deadlock). Mechanisms like 'resource hierarchy' or 'waiter (arbiter)' must be introduced.
Introduction
How to use
Resource competition deadlock. Metaphor for resource allocation in organizations. If everyone holds a portion of resources without releasing, waiting for others to release, the whole organization becomes paralyzed (deadlock). Mechanisms like 'resource hierarchy' or 'waiter (arbiter)' must be introduced.
Mechanism
Five philosophers sit around a table, alternating between thinking and eating. Each needs to pick up both left and right chopsticks simultaneously. If all pick up the left chopstick at the same time, deadlock occurs; if they randomly put down, starvation may occur. It abstracts the mutual exclusion and synchronization issues of multiple processes competing for limited shared resources.
Practice
In progress 0/4Practice this model in one real situation:
Cases
- Database transaction lock contention; multi-threaded concurrent access to shared buffers.
Common pitfalls
- Thinking that locking always solves the problem (improper locking can cause deadlock); ignoring fairness and livelock.
Sources
Source support: Explicit
References currently contain only Wikipedia links; primary sources still need review.
- zh.wikipedia.orghttps://zh.wikipedia.org/wiki/%E5%93%B2%E5%AD%A6%E5%AE%B6%E5%B0%B1%E9%A4%90%E9%97%AE%E9%A2%98verified
account_treeGenealogyexpand_more
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS