119
Using xchg for mutual exclusion
nShared variable b is initialized to 0 nEach Pi has a local variable k nThe only Pi that can enter CS is the one who finds b=0 nThis Pi excludes all the other Pj by setting b to 1
Process Pi:
repeat
  k:=1 
  repeat xchg(k,b)
  until k=0;
     CS
  b:=0;
     RS
forever