|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ä |
Keep
1 Bool variable for
|
|
each
process: flag[0] and
|
|
|
flag[1]
|
|
|
ä |
Pi
signals that it is ready
|
|
|
to
enter it’s CS by:
|
|
|
flag[i]:=true
|
|
|
ä |
Mutual
Exclusion is
|
|
|
satisfied
but not the
|
|
|
progress
requirement
|
|
|
ä |
If
we have the sequence:
|
|
|
|
ä |
T0:
flag[0]:=true
|
|
|
|
ä |
T1:
flag[1]:=true
|
|
|
ä |
Both
process will wait
|
|
|
forever
to enter their CS:
|
|
|
we
have a deadlock
|
|
|
|
|
|
|
|
|
Process
Pi:
|
|
repeat
|
|
|
flag[i]:=true;
|
|
while(flag[j])
|
{};
|
|
CS
|
|
|
flag[i]:=false
|
;
|
|
RS
|
|
forever
|
|
|
|