Copyright © Philip M. Parker, INSEAD. Terms of Use.

DINING PHILOSOPHERS PROBLEM

Specialty Definition: DINING PHILOSOPHERS PROBLEM

DomainDefinition

Computing

Dining Philosophers Problem (DPP) A problem introduced by Dijkstra concerning resource allocation between processes. The DPP is a model and universal method for testing and comparing theories on resource allocation. Dijkstra hoped to use it to help create a layered operating system, by creating a machine which could be consider to be an entirely deterministic automaton. The problem consists of a finite set of processes which share a finite set of resources, each of which can be used by only one process at a time, thus leading to potential deadlock. The DPP visualises this as a number of philosophers sitting round a dining table with a fork between each adjacent pair. Each philosopher may arbitrarily decide to use either the fork to his left or the one to his right but each fork may only be used by one philosopher at a time. Several potential solutions have been considered. Semaphores - a simple, but unfair solution where each resources is a binary semaphore and additional semaphores are used to avoid deadlock and/or starvation. Critical Regions - each processor is protected from interference while it exclusively uses a resource. Monitors - the process waits until all required resources are available then grabs all of them for use. The best solution allows the maximum parallelism for any number of processes (philosophers), by using an array to track the process' current state (i.e. hungry, eating, thinking). This solution maintains an array of semaphores, so hungry philosophers trying to acquire resources can block if the needed forks are busy. (1998-08-09). Source: The Free On-line Dictionary of Computing.

Source: compiled by the editor from various references; see credits.

Top     

Specialty Definition: Dining philosophers problem

(From Wikipedia, the free Encyclopedia)

In computer science, the dining philosophers problem is an illustrative example of a common computing problem.

In 1965, Edsger Dijkstra used the example of a group of philosophers to solve a synchronization problem. Five philosophers are sat around a circular table and each has a plate of spaghetti in front of him with a fork either side (i.e. five philosophers, five plates, and five forks). Suppose that the life of a philosopher consists of periods of eating and thinking, that each philosopher needs two forks to eat, and that forks are picked up one at a time. After successfully picking up two forks, a philosopher eats for a while and then puts down the forks and thinks. The problem consists in developing an algorithm to avoid starvation and deadlock. Deadlock might occur if each of the five philosophers has one fork and no one can get a second fork. The philosopher a waits for the fork grabbed by philosopher b who is waiting for the fork of philosopher c and so forth, making a circular chain of deadlock. Starvation might also happen independently of deadlock if a philosopher is unable to acquire both forks.

The solution consists of having the philosophers report their state as hungry, thinking, and eating. A philosopher cannot eat unless he has declared his state as hungry and both of his neighboring philosophers are not eating. The status of the philosophers is kept using a shared data struture (e.g an array). A philosopher may enter the eating state only if both of its neighbors are not in that state. To ensure this, the philosopher obtains a mutex lock and then changes his state from thinking to hungry. After he changes his state, he tries to obtain both forks and will not do so until both of his neighbors have left the eating state. At which point the philosopher, changes his state to eating and releases the lock. The philosopher then eats. After the philosopher is done eating, he again obtains a mutex lock, changes his state to thinking and sees, one at a time, if any of its two neighbors is hungry. If at least one is hungry, that philosopher enters the eating state and the cycle continues.

The lack of available forks is an analogy to the locking of scarce resources in real computer programming, a situation known as concurrency. Locking a resource is a common technique to ensure the resource is accessed by only one program or chunk of code at a time. When the resource the program is interested in is already locked by another one, the program waits until it is unlocked. When several resources are involved in locking resources, deadlock might happen, depending on the circumstances. For example, one program needs two files to process. When two such programs lock one file each, both programs wait for the other one to unlock the other file, which never happens.

See also

External link

Source: adapted by the editor from Wikipedia, the free encyclopedia under a copyleft GNU Free Documentation License (GFDL) from the article "Dining philosophers problem."

Top     

Crosswords: DINING PHILOSOPHERS PROBLEM

Specialty definitions using "DINING PHILOSOPHERS PROBLEM": DPP. (references)

Top     

Alternative Orthography: DINING PHILOSOPHERS PROBLEM


Hexadecimal (or equivalents, 770AD-1900s) (references)

44 49 4E 49 4E 47      50 48 49 4C 4F 53 4F 50 48 45 52 53      50 52 4F 42 4C 45 4D

Leonardo da Vinci (1452-1519; backwards) (references)

        

Binary Code (1918-1938, probably earlier) (references)

01000100 01001001 01001110 01001001 01001110 01000111 00100000 01010000 01001000 01001001 01001100 01001111 01010011 01001111 01010000 01001000 01000101 01010010 01010011 00100000 01010000 01010010 01001111 01000010 01001100 01000101 01001101

HTML Code (1990) (references)

&#68 &#73 &#78 &#73 &#78 &#71 &#32 &#80 &#72 &#73 &#76 &#79 &#83 &#79 &#80 &#72 &#69 &#82 &#83 &#32 &#80 &#82 &#79 &#66 &#76 &#69 &#77

ISO 10646 (1991-1993) (references)

0044 0049 004E 0049 004E 0047      0050 0048 0049 004C 004F 0053 004F 0050 0048 0045 0052 0053      0050 0052 004F 0042 004C 0045 004D

Encryption (beginner's substitution cypher): (references)

3843484348412504243464953495042395253250524936463947

Top     



INDEX

1. Crosswords
2. Orthography
3. Bibliography


  

Copyright © Philip M. Parker, INSEAD. Terms of Use.