Software Solutions: Algorithm 1
äThe shared variable turn is initialized (to
0 or 1) before executing any Pi
äPi’s critical section is executed iff turn
= i
äPi is busy
waiting if Pj is in CS: mutual exclusion is satisfied
äProgress
requirement is not satisfied since it requires strict alternation of
CSs
äEx: if turn=0 and P0 is in it’s RS, P1 can never enter it’s CS
Process Pi:
repeat
while(turn!=i){};
CS
turn:=j;
RS
forever