NIST

dining philosophers

(classic problem)

Definition: Suppose a number of philosophers surround a dining table. Adjacent philosophers share one fork. They spend time thinking or trying to eat. A philosopher must have both the fork on the left and the fork on the right to eat. Clearly adjacent philosophers cannot eat at the same time. The problem is to find an algorithm for taking forks that prevents deadlock, starvation, etc.

Author: PEB

Implementation

code Shared Memory and Semaphores (C and C++).
Go to the Dictionary of Algorithms and Data Structures home page.

If you have suggestions, corrections, or comments, please get in touch with Paul Black.

Entry modified 30 June 2014.
HTML page formatted Fri Feb 23 10:06:07 2018.

Cite this as:
Paul E. Black, "dining philosophers", in Dictionary of Algorithms and Data Structures [online], Vreda Pieterse and Paul E. Black, eds. 30 June 2014. (accessed TODAY) Available from: https://www.nist.gov/dads/HTML/diningphilos.html