{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,3,20]],"date-time":"2026-03-20T22:45:19Z","timestamp":1774046719591,"version":"3.50.1"},"reference-count":24,"publisher":"MDPI AG","issue":"12","license":[{"start":{"date-parts":[[2025,11,23]],"date-time":"2025-11-23T00:00:00Z","timestamp":1763856000000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":["Computers"],"abstract":"<jats:p>Lamport\u2019s Bakery algorithm (LBA) represents a general and elegant solution to the mutual exclusion (ME) problem posed by Dijkstra in 1965. Its correctness is usually based on intuitive reasoning. LBA rests on an unbounded number of tickets, which prevents correctness assessment by model checking. Several variants are proposed in the literature to bound the number of exploited tickets. This paper is based on a formal method centered on Uppaal for reasoning about general shared-memory ME algorithms. A model can (hopefully) be verified by the exhaustive model checker (MC), and\/or by the statistical model checker (SMC) through stochastic simulations. To overcome the scalability problems of SMC, a model can be reduced to actors and simulated in Java. The paper formalizes LBA and demonstrates, through simulations, that it is correct with atomic and non-atomic memory registers. Then, some representative variants with bounded tickets are studied, which prove to be accurate with atomic registers, or which confirm their correctness under atomic or non-atomic registers.<\/jats:p>","DOI":"10.3390\/computers14120507","type":"journal-article","created":{"date-parts":[[2025,11,24]],"date-time":"2025-11-24T13:09:25Z","timestamp":1763989765000},"page":"507","update-policy":"https:\/\/doi.org\/10.3390\/mdpi_crossmark_policy","source":"Crossref","is-referenced-by-count":1,"title":["Formal Analysis of Bakery-Based Mutual Exclusion Algorithms"],"prefix":"10.3390","volume":"14","author":[{"ORCID":"https:\/\/orcid.org\/0000-0001-6577-4777","authenticated-orcid":false,"given":"Libero","family":"Nigro","sequence":"first","affiliation":[{"name":"DIMES\u2014Engineering Department of Informatics Modeling Electronics and Systems Science, University of Calabria, 87036 Rende, Italy"}],"role":[{"role":"author","vocabulary":"crossref"}]}],"member":"1968","published-online":{"date-parts":[[2025,11,23]]},"reference":[{"key":"ref_1","doi-asserted-by":"crossref","first-page":"453","DOI":"10.1145\/361082.361093","article-title":"A new solution of Dijkstra\u2019s concurrent programming problem","volume":"17","author":"Lamport","year":"1974","journal-title":"Commun. ACM"},{"key":"ref_2","doi-asserted-by":"crossref","first-page":"569","DOI":"10.1145\/365559.365617","article-title":"Solution of a problem in concurrent programming control","volume":"8","author":"Dijkstra","year":"1965","journal-title":"Commun. ACM"},{"key":"ref_3","doi-asserted-by":"crossref","unstructured":"Clarke, E.M., Klieber, W., Nov\u00e1\u010dek, M., and Zuliani, P. (2011). Model checking and the state explosion problem. LASER Summer School on Software Engineering, Springer.","DOI":"10.1007\/978-3-642-35746-6_1"},{"key":"ref_4","first-page":"8160","article-title":"Model checking time-dependent system specifications using time stream Petri nets and UPPAAL","volume":"218","author":"Cicirelli","year":"2012","journal-title":"Appl. Math. Comput."},{"key":"ref_5","doi-asserted-by":"crossref","unstructured":"Groote, J.F., Keiren, J.J., Luttik, B., de Vink, E.P., and Willemse, T.A. (2020). Modelling and analysing software in mCRL2. Formal Aspects of Component Software, Proceedings of the 16th International Conference, FACS 2019, Amsterdam, The Netherlands, 23\u201325 October 2019, Springer International Publishing.","DOI":"10.1007\/978-3-030-40914-2_2"},{"key":"ref_6","doi-asserted-by":"crossref","first-page":"6","DOI":"10.1145\/3158668","article-title":"A survey of statistical model checking","volume":"28","author":"Agha","year":"2018","journal-title":"ACM Trans. Model. Comput. Simul. (TOMACS)"},{"key":"ref_7","doi-asserted-by":"crossref","first-page":"236","DOI":"10.3934\/aci.2025014","article-title":"Formal verification of mutual exclusion algorithms in anonymous memory","volume":"5","author":"Nigro","year":"2025","journal-title":"J. Appl. Comput. Intell."},{"key":"ref_8","doi-asserted-by":"crossref","unstructured":"Bernardo, M., and Corradini, F. (2004). A tutorial on UPPAAL. Formal Methods for the Design of Real-Time Systems, Springer.","DOI":"10.1007\/b110123"},{"key":"ref_9","doi-asserted-by":"crossref","first-page":"397","DOI":"10.1007\/s10009-014-0361-y","article-title":"Uppaal SMC tutorial","volume":"17","author":"David","year":"2015","journal-title":"Int. J. Softw. Tools Technol. Transf."},{"key":"ref_10","doi-asserted-by":"crossref","first-page":"102189","DOI":"10.1016\/j.simpat.2020.102189","article-title":"Parallel Theatre: An actor framework in Java for high performance computing","volume":"106","author":"Nigro","year":"2021","journal-title":"Simul. Model. Pract. Theory"},{"key":"ref_11","doi-asserted-by":"crossref","first-page":"806","DOI":"10.1145\/359863.359878","article-title":"Concurrent reading and writing","volume":"20","author":"Lamport","year":"1977","journal-title":"Commun. ACM"},{"key":"ref_12","doi-asserted-by":"crossref","first-page":"144","DOI":"10.1002\/cpe.3659","article-title":"Dekker\u2019s mutual exclusion algorithm made RW-safe","volume":"28","author":"Buhr","year":"2016","journal-title":"Concurr. Comput. Pract. Exp."},{"key":"ref_13","unstructured":"Spronck, M., and Luttik, B. (2023, January 18\u201323). Process-algebraic models of multi-writer multi-reader non-atomic registers. Proceedings of the 34th International Conference on Concurrency Theory (CONCUR) 2023, Antwerp, Belgium."},{"key":"ref_14","doi-asserted-by":"crossref","unstructured":"Nigro, L. (2024). Verifying mutual exclusion algorithms with non-atomic registers. Algorithms, 17.","DOI":"10.3390\/a17120536"},{"key":"ref_15","doi-asserted-by":"crossref","unstructured":"Taubenfeld, G. (2004). The black-white bakery algorithm and related bounded-space, adaptive, local-spinning and FIFO algorithms. International Symposium on Distributed Computing, Springer.","DOI":"10.1007\/978-3-540-30186-8_5"},{"key":"ref_16","doi-asserted-by":"crossref","first-page":"1055","DOI":"10.1016\/j.ipl.2010.09.004","article-title":"Highly-fair bakery algorithm using symmetric tokens","volume":"110","author":"Aravind","year":"2010","journal-title":"Inf. Process. Lett."},{"key":"ref_17","doi-asserted-by":"crossref","unstructured":"Sayyadabdi, A., and Sharifi, M. (2020, January 17\u201320). Avoiding register overflow in the bakery algorithm. Proceedings of the Workshop Proceedings of the 49th International Conference on Parallel Processing, Edmonton, AB, Canada.","DOI":"10.1145\/3409390.3409411"},{"key":"ref_18","unstructured":"Nigro, L., and Cicirelli, F. (2025, January 19\u201321). Statistical model checking of Lamport\u2019s Bakery mutual exclusion algorithm. Proceedings of the 9th International World Conference on Smart Trends in Systems, Security and Sustainability (WorldS4 2025), London, UK."},{"key":"ref_19","doi-asserted-by":"crossref","first-page":"73","DOI":"10.1007\/s00236-008-0086-z","article-title":"A queue based mutual exclusion algorithm","volume":"46","author":"Aravind","year":"2009","journal-title":"Acta Inform."},{"key":"ref_20","doi-asserted-by":"crossref","first-page":"651","DOI":"10.1002\/cpe.3263","article-title":"High-performance N-thread software solutions for mutual exclusion","volume":"27","author":"Buhr","year":"2015","journal-title":"Concurr. Comput. Pract. Exp."},{"key":"ref_21","unstructured":"Jayanti, P., Tan, K., Friedland, G., and Katz, A. (2001). Bounding Lamport\u2019s bakery algorithm. SOFSEM 2001: Theory and Practice of Informatics, Proceedings of the 28th Conference on Current Trends in Theory and Practice of Informatics Piestany, Slovak Republic, 24 November\u20131 December 2001, Springer."},{"key":"ref_22","unstructured":"Vijayaraghavan, S. (April, January 30). A variant of the bakery algorithm with bounded values as a solution to Abraham\u2019s concurrent programming problem. Proceedings of the Design, Analysis and Simulation of Distributed Systems, Orlando, FL, USA."},{"key":"ref_23","doi-asserted-by":"crossref","first-page":"67","DOI":"10.1007\/s00236-011-0132-0","article-title":"Nonatomic dual bakery algorithm with bounded tokens","volume":"48","author":"Aravind","year":"2011","journal-title":"Acta Inform."},{"key":"ref_24","doi-asserted-by":"crossref","first-page":"833","DOI":"10.1007\/s00165-016-0407-x","article-title":"Tournaments for mutual exclusion: Verification and concurrent complexity","volume":"29","author":"Hesselink","year":"2017","journal-title":"Form. Asp. Comput."}],"container-title":["Computers"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/www.mdpi.com\/2073-431X\/14\/12\/507\/pdf","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,11,26]],"date-time":"2025-11-26T05:19:02Z","timestamp":1764134342000},"score":1,"resource":{"primary":{"URL":"https:\/\/www.mdpi.com\/2073-431X\/14\/12\/507"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2025,11,23]]},"references-count":24,"journal-issue":{"issue":"12","published-online":{"date-parts":[[2025,12]]}},"alternative-id":["computers14120507"],"URL":"https:\/\/doi.org\/10.3390\/computers14120507","relation":{},"ISSN":["2073-431X"],"issn-type":[{"value":"2073-431X","type":"electronic"}],"subject":[],"published":{"date-parts":[[2025,11,23]]}}}