138
The Dining Philosophers Problem
nA solution: admit only 4 philosophers at a time that tries to eat
nThen 1 philosopher can always eat when the other 3 are holding 1 fork
nHence, we can use another semaphore T that would limit at 4 the numb. of philosophers “sitting at the table”
nInitialize: T.count:=4
Process Pi:
repeat
 think;
 wait(T);
 wait(fork[i]);
 wait(fork[i+1 mod 5]);
 eat;
 signal(fork[1+1 mod 5]);
 signal(fork[i]);
 signal(T); 
forever