107
Algorithm 2
nKeep 1  Bool variable for each process: flag[0] and flag[1]
nPi signals that it is ready to enter it’s CS by: flag[i]:=true
nMutual Exclusion is satisfied but not the progress requirement
nIf we have the sequence:
uT0: flag[0]:=true
uT1: flag[1]:=true
nBoth process will wait forever to enter their CS: we have a deadlock
n
Process Pi:
repeat
  flag[i]:=true; 
  while(flag[j]){};
     CS
  flag[i]:=false;
     RS
forever