1. Mutual Exclusion

Hello,

I'm trying to understand algorithm to this mutual exclusion problem/example:

Code:
```repeat
(while turn != 0);
// critical section
turn = 1;
// non-critical section
until false;

repeat
(while turn != 1);
// critical section
turn = 0;
// non-critical section
until false;```
Why is there a ; after the while statement as if its doing nothing? Does the statement after ; still get executed?

It seems a bit backwards to me. Every example of this solution I see implemented this way.

Why dont they write
Code:
```(while turn == 1){
// critical section
}

(while turn == 0){
// critical section
}```
This seems to be straight forward. Am I missing something here?

2. That is not C++ code, more like a pseudo-code, but it would be one of the least understandable pseudocodes out there. I have no idea what these codes are suppose to illustrate, sorry.

3. Probably it should be
while (turn != 0);
in real code.
It would loop while turn != 0, but the body is empty. That is, basically it does nothing.
This relies on that turn would have to change due to external factors or it would be an endless loop.

4. makes sense!