Formal Aspects of Computing

, Volume 28, Issue 2, pp 325–341 | Cite as

Correctness and concurrent complexity of the Black-White Bakery Algorithm

  • Wim H. Hesselink
Open Access
Original Article


Lamport’s Bakery Algorithm (Commun ACM 17:453–455, 1974) implements mutual exclusion for a fixed number of threads with the first-come first-served property. It has the disadvantage, however, that it uses integer communication variables that can become arbitrarily large. Taubenfeld’s Black-White Bakery Algorithm (Proceedings of the DISC. LNCS, vol 3274, pp 56–70, 2004) keeps the integers bounded, and is adaptive in the sense that the time complexity only depends on the number of competing threads, say N. The present paper offers an assertional proof of correctness and shows that the concurrent complexity for throughput is linear in N, and for individual progress is quadratic in N. This is proved with a bounded version of UNITY, i.e., by assertional means.


Mutual exclusion FCFS Concurrent complexity UNITY 


  1. AdBO09.
    Apt KR, de Boer FS, Olderog E-R: Verification of sequential and concurrent programs. Springer, New York (2009)CrossRefzbMATHGoogle Scholar
  2. Ara13.
    Aravind A: Simple, space-efficient, and fairness improved FCFS mutual exclusion algorithms. J Parallel Distrib Comput 73, 1029–1038 (2013)CrossRefzbMATHGoogle Scholar
  3. AST99.
    Afek Y, Stupp G, Touitou D (1999) Long-lived adaptive collect with applications. In: Proceedings 40th IEEE symp. on foundations of computer science, pp 262–272Google Scholar
  4. BDH15.
    Buhr PA, Dice D, Hesselink WH (2015) High-performance N-thread software solutions for mutual exclusion. Concurr Comput Pract Exp 27:651–701. doi: 10.1002/cpe.3263
  5. CM88.
    Chandy KM, Misra J: Parallel program design. A foundation. Addison–Wesley, Menlo Park (1988)zbMATHGoogle Scholar
  6. Dij65.
    Dijkstra EW: Solution of a problem in concurrent programming control. Commun ACM 8, 569 (1965)CrossRefGoogle Scholar
  7. Hes98.
    Hesselink WH: Progress under bounded fairness. Distrib Comput 12, 197–207 (1988)CrossRefGoogle Scholar
  8. Hes13a.
    Hesselink WH: Mechanical verification of Lamport’s Bakery Algorithm. Sci Comput Program 78, 1622–1638 (2013)CrossRefGoogle Scholar
  9. Hes13b.
    Hesselink WH: Verifying a simplification of mutual exclusion by Lycklama–Hadzilacos. Acta Inf 50, 297–329 (2013)MathSciNetCrossRefzbMATHGoogle Scholar
  10. Hes15a.
    Hesselink WH (2015) Mutual exclusion by four shared bits with not more than quadratic complexity. Sci Comput Program 102:57–75. doi: 10.1016/j.scico.2015.01.001
  11. Hes15b.
    Hesselink WH (2015) PVS proof scripts for four Bakery Algorithms. Accessed 17 March 2016
  12. Lam74.
    Lamport L: A new solution of Dijkstra’s concurrent programming problem. Commun ACM 17, 453–455 (1974)MathSciNetCrossRefzbMATHGoogle Scholar
  13. Lam86a.
    Lamport L: The mutual exclusion problem—part I: a theory of interprocess communication, part II: statement and solutions. J ACM 33, 313–348 (1986)MathSciNetCrossRefzbMATHGoogle Scholar
  14. Lam86b.
    Lamport L: On interprocess communication. Parts I and II. Distrib Comput 1, 77–101 (1986)CrossRefzbMATHGoogle Scholar
  15. LH91.
    Lycklama EA, Hadzilacos V. (1991) A first-come-first-served mutual-exclusion algorithm with small communication variables. ACM Trans Program Lang Syst 13:558–576Google Scholar
  16. Mis01.
    Misra J: A discipline of multiprogramming: programming theory for distributed applications. Springer, New York (2001)CrossRefzbMATHGoogle Scholar
  17. NLWSD14.
    Nanevski A, Ley-Wild R, Sergey I, Delbianco GA (2014) Communicating state transition systems for fine-grained concurrent resources. In: Shao Z (ed) ESOP 2014. LNCS, vol 8410, pp 290–310Google Scholar
  18. OG76.
    Owicki S, Gries D: An axiomatic proof technique for parallel programs. Acta Inf 6, 319–340 (1976)MathSciNetCrossRefzbMATHGoogle Scholar
  19. OSRSC01.
    Owre S, Shankar N, Rushby JM, Stringer-Calvert DWJ (2001) PVS version 2.4, system guide, prover guide, PVS language reference. Accessed 17 March 2016
  20. Tau04.
    Taubenfeld G (2004) The Black-White Bakery Algorithm and related bounded-space, adaptive, local-spinning and FIFO algorithms. In: Proceedings of the DISC. LNCS, vol 3274, pp 56–70Google Scholar

Copyright information

© The Author(s) 2016

Open AccessThis article is distributed under the terms of the Creative Commons Attribution 4.0 International License (, which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.

Authors and Affiliations

  1. 1.Johann Bernoulli InstituteUniversity of GroningenGroningenThe Netherlands

Personalised recommendations