I'd like to state the obvious here. In the code below, choosing[i] does not need to be inside a critical section because a thread i only writes to the position i in the shared array. So while the array is shared as everyone reads from the same array, only one array writes to any particular position. Thus, mutual exclusion is not violated in writing choosing array.
Just a reminder, mutual exclusion is
A way of making sure that if one process is using a shared modifiable data, the other processes will be excluded from doing the same thing.
http://www.personal.kent.edu/~rmuhamma/OpSystems/Myos/mutualExclu.htm
While(true) { L1: choosing[i] = 1;number[i] = 1 + max(number[1], ..., number[N]);choosing[i] = 0; for (int j = 1; j <= N; j++) { L2: while (choosing[j] = 1) {} L3: while(number[j] <>0 and (number[j],j) < (number[i], i)) {} } Critical Section number[i] = 0; }