Lamport's bakery algorithm.