|
|
|
|
|
|
|
|
|
|
|
u |
If Pj has set
flag[j]=true and is in its while(),
|
|
|
then either
turn=i or turn=j
|
|
|
u |
If turn=i, then
Pi enters CS. If turn=j then Pj
|
|
|
enters CS but
will then reset flag[j]=false on
|
|
|
|
exit: allowing Pi
to enter CS
|
|
|
u |
but if Pj has
time to reset flag[j]=true, it must
|
|
|
also set turn=i
|
|
|
u |
since Pi does
not change value of turn while
|
|
|
|
stuck in
while(), Pi will enter CS after at most
|
|
one CS entry by
Pj (bounded waiting)
|
|