112
The bakery algorithm (cont.)
nShared data:
uchoosing: array[0..n-1] of boolean;
Finitialized to false
unumber: array[0..n-1] of integer;
Finitialized to 0
nCorrectness relies on the following fact:
uIf Pi is in CS and Pk has already chosen its number[k]!= 0, then (number[i],i) < (number[k],k)
ubut the proof is somewhat tricky...