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.

[1]  Leslie Lamport,et al.  A new solution of Dijkstra's concurrent programming problem , 1974, Commun. ACM.

[2]  Stephan Merz,et al.  Verifying Safety Properties with the TLA+ Proof System , 2010, IJCAR.

[3]  Michel Raynal,et al.  Algorithms for mutual exclusion , 1986 .

[4]  Edsger W. Dijkstra,et al.  Solution of a problem in concurrent programming control , 1965, CACM.

[5]  Leslie Lamport What it means for a concurrent program to satisfy a specification: why no one has specified priority , 1985, POPL '85.

[6]  Egon Börger,et al.  The bakery algorithm: yet another specification and verification , 1993, Specification and validation methods.

[7]  Leslie Lamport A New Approach to Proving the Correctness of Multiprocess Programs , 1979, TOPL.

[8]  Hagit Attiya,et al.  Distributed Computing: Fundamentals, Simulations and Advanced Topics , 1998 .

[9]  Leslie Lamport,et al.  A fast mutual exclusion algorithm , 1987, TOCS.

[10]  Mordechai Ben-Ari,et al.  Formal Verification of the Ricart-Agrawala Algorithm , 2000, FSTTCS.

[11]  Nancy A. Lynch,et al.  Distributed Algorithms , 1992, Lecture Notes in Computer Science.

[12]  Wim H. Hesselink Mechanical verification of Lamport's Bakery algorithm , 2013, Sci. Comput. Program..

[13]  Uri Abraham Logical classification of distributed algorithms (Bakery algorithms as an example) , 2011, Theor. Comput. Sci..

[14]  Leslie Lamport,et al.  On interprocess communication , 1986, Distributed Computing.

[15]  James H. Anderson Lamport on mutual exclusion: 27 years of planting seeds , 2001, PODC '01.

[16]  Ronald Fagin,et al.  Reasoning about knowledge , 1995 .