Controlled access to shared data

Lamport's Bakery Algorithm

The Bakery algorithm solves the critical section problem for more than two processes. Its name comes from the way in which a bakery or a deli counter works: customers choose a unique number that is larger than any previously choosen number and are then served in turn. First, some notation: