110
Algorithm 3: proof of correctness (cont.)
uIf Pj has set flag[j]=true and is in its while(), then either turn=i or turn=j uIf 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 ubut if Pj has time to reset flag[j]=true, it must also set turn=i usince 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)