Under the Hood of the Bakery Algorithm: Mutual Exclusion as a Matter of Priority
A new approach to the study and analysis of Mutual Exclusion (ME) algorithms is presented, based on identifying the priority relation that the ME algorithm constructs. It is argued that by analyzing how a process detects that it has priority over all other processes, ME algorithms can be better understood and improved. The approach is illustrated by applying it to Lamport’s celebrated Bakery algorithm in the safe register SWMR model. By analyzing how Bakery established and detects priority, cases in which the Bakery algorithm causes processes to block unnecessarily are identified. Namely, a process that already knows that it has priority over another process is made to perform reads and wait on registers of the other process. An optimized version of the Bakery algorithm, called Boulangerie, is proposed, and is shown to be free of any unnecessary blocking. A second contribution of the approach is obtaining a clear explanation for how the Bakery algorithm uses reads from safe registers to detect that a process has priority. Our analysis provides more insight into the workings of the Bakery algorithm than is obtained by other proofs of its correctness.
Keywordsmutual exclusion Bakery algorithm safe registers Boulangerie algorithm
Unable to display preview. Download preview PDF.
- 2.Anderson, J.H.: Lamport on mutual exclusion: 27 years of planting seeds. In: Proceedings of the 20th ACM PODC Conference, pp. 3–12 (2001)Google Scholar
- 3.Attiya, H., Welch, J.: Distributed computing: fundamentals, simulations, and advanced topics, vol. 19 (2004)Google Scholar
- 6.Fagin, R., Halpern, J.Y., Moses, Y., Vardi, M.Y.: Reasoning about Knowledge (2003)Google Scholar
- 11.Lamport, L.: What it means for a concurrent program to satisfy a specification: Why no one has specified priority. In: Proceedings of the 12th ACM POPL, pp. 78–83 (1985)Google Scholar
- 14.Lamport, L.: A TLA+ mechanical proof of the Boulangerie Algorithm (2015). http://research.microsoft.com/en-us/um/people/lamport/tla/boulangerie.html
- 15.Lamport, L.: The TLA+ Hyperbook (2015). http://research.microsoft.com/en-us/um/people/lamport/tla/hyperbook.html
- 16.Lynch, N.A.: Distributed Algorithms (1996)Google Scholar
- 17.Raynal, M., Beeson, D.: Algorithms for Mutual Exclusion (1986)Google Scholar
- 18.Rosenzweig, D., Börger, E., Gurevich, Y.: The bakery algorithm: yet another specification and verification. In: Börger, E. (ed.) Specification and Validation Methods, pp. 231–243 (1995)Google Scholar