flag[0]=flag[1]=FALSE initially.
Assume turn =1 (initially).
1) P1 starts executing . Makes flag[0]=True.
while(turn!=0) //Enter this Loop Bcoz Turn=1 actually.
{
2) P1 gets preempted here and P2 starts.Makes flag[1]=True
while(turn!=1) //False bcoz turn=1 actually.Dont enter loop.
ENTER CRITICAL SECTION
Make flag[1] = False.
3) Now P2 gets Preempted and P1 continue from where it left.
while flag[1]==TRUE then keep moving in Loop . // but flag[1] is False already.So dont enter it.
4) Now P1 gets Preempted and P2 starts again.Makes flag[1]=True.
while(turn!=1) // turn is still Equal to 1 bcoz no one updated it to 0. So dont enter loop.
ENTER CS.
5) Now P2 gets Preempted and P1 continues from where it left.
turn = 0
So now WHILE loop breaks and P0 also enter CS.
So MUTUAL EXCLUSION itself is Not guaranteed if this order is followed.