|
|
|
|
|
|
|
|
|
|
|
|
|
n |
A solution:
admit only 4
|
|
|
|
philosophers
at a time
|
|
|
that tries to
eat
|
|
|
n |
Then 1
philosopher can
|
|
|
always eat
when the other
|
|
|
|
3 are holding
1 fork
|
|
|
n |
Hence, we can
use
|
|
|
another
semaphore T that
|
|
|
would limit
at 4 the numb.
|
|
|
|
of
philosophers “sitting at
|
|
the table”
|
|
|
n |
Initialize:
T.count:=4
|
|
|
|
|