The Bakery Algorithm (cont).
Shared number: array [1..n] of integer = [0,…, 0];
Shared choosing: array [1..n] of boolean=[false,..., false];
choosing[ i ] := true; number[ i ] :=max( number[1..n] ) + 1;
while choosing[ j ] do no-op;
while (number[ j ] ? 0 and
(number[ j ], j ) < (number[ i ], i ) )do no-op;