Here is a picture of Peterson's algorithm from https://en.wikipedia.org/wiki/Peterson%27s_algorithm :
Is it possible for both processes to block each other?
For example:
Process 0 sets flag[0] = true;
Process 0 is interrupted and process 1 starts.
Process 1 sets flag[1] = true;.
Process 1 is interrupted and then process 0 starts again.
Process 0 sets turn = 1;, and so now the while loop condition is met, blocking process 0.
Process 0 is interrupted and process 1 starts again
Process 1 sets turn = 0;, and so now the while loop condition is met, blocking process 1.
Now both processes are blocked.
