|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
n |
Shared data:
|
|
|
|
u |
choosing:
array[0..n-1] of boolean;
|
|
|
|
F |
initialized to
false
|
|
|
|
u |
number:
array[0..n-1] of integer;
|
|
|
|
F |
initialized to 0
|
|
|
n |
Correctness
relies on the following fact:
|
|
|
|
u |
If Pi is in CS
and Pk has already chosen its
|
|
|
|
number[k]!= 0,
then (number[i],i) < (number[k],k)
|
|
|
u |
but the proof is
somewhat tricky...
|
|