Monitor for the Dining Philosophers
Monitor dining-philosophers
Array[1..5] of (think, hungry, eat) : State;
Array[1..5] of condition : Self;
procedure entry pickup( i )
if State[i]?eat then Self[i].wait;
procedure entry putdown( i )
for i:= 1 to 5 state[i] = think;
if State[k-1 mod 5] ? eat and
State[k+1 mod 5] ? eat then