I have read this for Peterson's algorithm for mutual exclusion.Then there was the question what will happen if we reorder the first and second command in the do...while loop? I cannot see something happening if we do that...Can someone tell me what I am missing?
do {
flag[me] = TRUE;
turn = other;
while (flag[other] && turn == other)
;
critical section
flag[me] = FALSE;
remainder section
} while (TRUE);