Quiz - Dining Phils
Spring 2003
Name:______________________________________________________________
-
What is the initial value of the semaphore array s[] and WHY?
0
Because if the boolean statement in test() returns false,
this philosopher should block when it downs its own semaphore
in take_forks(). If the boolean is true, the philosopher will
up its semaphore beforehand, so that it can go ahead and eat.
-
Where are the forks?
That is, how are the forks implemented.
Forks do not exist as forks. Rather they are implemented as
phil state - eating phils have both forks; hungry phils
have no forks and want them; thinking phils have no forks
and do not want them.
-
Why is the state variable set to hungry in the
procedure take_forks?
So that in test() we know that he is hungry.
Last modified Mar, 4 by mike@cs.hmc.edu