Peterson's solution

I think that that the variable ‘int turn’ is not for allowing the other process to go first but it refers to “waiting turn”. That this process has to wait for his turn.
And second doubt is,
for process 0,
flag[i] = true;
turn = j;
/*
I have doubt in this while loop. The while loop should break as true && false should evaluate false. And while loop runs till a false is encountered. So how will the process 1 wait ?
*/
while(turn == j && flag[j]){
// wait process 1
}
@championswimmer-t