Dining Philosophers

Dining Philosophers (Diners)
Problem



definition
Chandy and Misra solution
extension to drinking philosophers
Definition





extension to mutual exclusion
arbitrary topology
each philosopher (process) proceeds
through the following cycle

thinking (out of the CS) may
remain indefinitely

hungry (requesting the CS)

eating (executing the CS) has to
finish within finite time
solution properties

safety – no two neighbors
eat at the same time

liveness – each hungry philosopher eventually eats
can a DMX solution be used to solve the diners problem? If yes, would
this solution be efficient?
Chandy-Misra[84] (Hygenic) Solution
Setup



each pair of diners share a fork

fork is clean before eating, fork is dirty during and after

diner cleans the fork only before giving it to neighbor
edge between diners u and v is oriented from u to v (u has
higher priority) if

u holds clean fork

v holds dirty fork,

fork is in transition from v to u
initially, thus oriented graph is acyclic, all forks are dirty
Chandy-Misra[84] (Hygenic) Solution
Details



•
•
•
if diner does not have fork – it sends request to the neighbor
process
gives up
dirty forks
and holds
clean
diner
can only
wait for higher
priority
neighbor
notice after eating, diner is a source (all his forks are dirty)
graph remains acyclic throughout operation
acyclic graph has a sink (lowest priority diner), that diner is guaranteed to
eat
Extension to Drinking Philosophers



definition

arbitrary topology

each pair of drinking philosophers share a bottle

philosopher alternates between being tranquil, thirsty and drinking

philosopher may be tranquil indefinitely but drinks only for finite
amount of time

philosopher may request to drink from an arbitrary subset of
adjacent bottles
properties

two neighbors cannot drink from the same bottle at the same time

each thirsty philosopher eventually drinks
relation to the other problems

can a solution to diners be used to solve the drinking philosophers
problem? Can a DMX solution? If yes, are they going to be
efficient?