That this algorithm achieves mutual exclusion can be proven as follows. Process exits the inner loop when there is either no process with a higher level than , so the next waiting room is free; or, when , so another process joined its waiting room. At level zero, then, even if all processes were to enter waiting room zero at the same time, no more than will proceed to the next room, the final one finding itself the last to enter the room. Similarly, at the next level, will proceed, etc., until at the final level, only one process is allowed to leave the waiting room and enter the critical section, giving mutual exclusion.