Abstract
Reasoning about concurrent programs is challenging, especially if data is shared among threads. Program correctness can be violated by the presence of data races—whose prevention has been a topic of concern both in research and in practice. The Rust programming language is a prime example, putting the slogan fearless concurrency in practice by not only employing an ownership-based type system for memory management, but also using its type system to enforce mutual exclusion on shared data. Locking, unfortunately, not only comes at the price of deadlocks but shared access to data may also cause memory leaks.
This paper develops a theory of deadlock and leak freedom for higher-order locks in a shared memory concurrent setting. Higher-order locks allow sharing not only of basic values but also of other locks and channels, and are themselves first-class citizens. The theory is based on the notion of a sharing topology, administrating who is permitted to access shared data at what point in the program. The paper first develops higher-order locks for acyclic sharing topologies, instantiated in a λ-calculus with higher-order locks and message-passing concurrency. The paper then extends the calculus to support circular dependencies with dynamic lock orders, which we illustrate with a dynamic version of Dijkstra’s dining philosophers problem. Well-typed programs in the resulting calculi are shown to be free of deadlocks and memory leaks, with proofs mechanized in the Coq proof assistant.
- Stephanie Balzer and Frank Pfenning. 2017. Manifest Sharing with Session Types. PACMPL, 1, ICFP (2017), 37:1–37:29. https://doi.org/10.1145/3110281
Google Scholar
Digital Library
- Stephanie Balzer, Frank Pfenning, and Bernardo Toninho. 2018. A Universal Session Type for Untyped Asynchronous Communication. In CONCUR (LIPIcs, Vol. 118). 30:1–30:18. https://doi.org/10.4230/LIPIcs.CONCUR.2018.30
Google Scholar
Cross Ref
- Stephanie Balzer, Bernardo Toninho, and Frank Pfenning. 2019. Manifest Deadlock-Freedom for Shared Session Types. In ESOP (LNCS, Vol. 11423). 611–639. https://doi.org/10.1007/978-3-030-17184-1_22
Google Scholar
Cross Ref
- Lorenzo Bettini, Mario Coppo, Loris D’Antoni, Marco De Luca, Mariangiola Dezani-Ciancaglini, and Nobuko Yoshida. 2008. Global Progress in Dynamically Interleaved Multiparty Sessions. In CONCUR (LNCS, Vol. 5201). 418–433. https://doi.org/10.1007/978-3-540-85361-9_33
Google Scholar
Digital Library
- Luís Caires and Frank Pfenning. 2010. Session Types as Intuitionistic Linear Propositions. In CONCUR (LNCS, Vol. 6269). 222–236. https://doi.org/10.1007/978-3-642-15375-4_16
Google Scholar
Cross Ref
- Luís Caires, Frank Pfenning, and Bernardo Toninho. 2016. Linear Logic Propositions as Session Types. Math. Struct. Comput. Sci., 26, 3 (2016), 367–423. https://doi.org/10.1017/S0960129514000218
Google Scholar
Cross Ref
- Marco Carbone and Søren Debois. 2010. A Graphical Approach to Progress for Structured Communication in Web Services. In ICE (EPTCS, Vol. 38). 13–27. https://doi.org/10.4204/EPTCS.38.4
Google Scholar
Cross Ref
- Marco Carbone, Sam Lindley, Fabrizio Montesi, Carsten Schürmann, and Philip Wadler. 2016. Coherence Generalises Duality: A Logical Explanation of Multiparty Session Types. In CONCUR (LIPIcs, Vol. 59). Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 33:1–33:15. https://doi.org/10.4230/LIPIcs.CONCUR.2016.33
Google Scholar
Cross Ref
- Marco Carbone, Fabrizio Montesi, Carsten Schürmann, and Nobuko Yoshida. 2015. Multiparty Session Types as Coherence Proofs. In CONCUR (LIPIcs, Vol. 42). Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 412–426. https://doi.org/10.4230/LIPIcs.CONCUR.2015.412
Google Scholar
Cross Ref
- Marco Carbone, Fabrizio Montesi, Carsten Schürmann, and Nobuko Yoshida. 2017. Multiparty session types as coherence proofs. Acta Informatica, 54, 3 (2017), 243–269. https://doi.org/10.1007/s00236-016-0285-y
Google Scholar
Digital Library
- David Castro-Perez, Francisco Ferreira, Lorenzo Gheri, and Nobuko Yoshida. 2021. Zooid: A DSL for Certified Multiparty Computation: From Mechanised Metatheory to Certified Multiparty Processes. In PLDI. 237–251. https://doi.org/10.1145/3453483.3454041
Google Scholar
Digital Library
- David G. Clarke, John Potter, and James Noble. 1998. Ownership Types for Flexible Alias Protection. In OOPSLA. ACM, 48–64. https://doi.org/10.1145/286936.286947
Google Scholar
Digital Library
- Mario Coppo, Mariangiola Dezani-Ciancaglini, Luca Padovani, and Nobuko Yoshida. 2013. Inference of Global Progress Properties for Dynamically Interleaved Multiparty Sessions. In COORDINATION. https://doi.org/10.1007/978-3-642-38493-6_4
Google Scholar
Cross Ref
- Mario Coppo, Mariangiola Dezani-Ciancaglini, Nobuko Yoshida, and Luca Padovani. 2016. Global Progress for Dynamically Interleaved Multiparty Sessions. MSCS, 26, 2 (2016), 238–302. https://doi.org/10.1017/S0960129514000188
Google Scholar
Cross Ref
- The Coq-std++ Team. 2021. An extended “standard library” for Coq. Available online at https://gitlab.mpi-sws.org/iris/stdpp
Google Scholar
- Pedro da Rocha Pinto, Thomas Dinsdale-Young, and Philippa Gardner. 2014. TaDA: A Logic for Time and Data Abstraction. In ECOOP (Lecture Notes in Computer Science, Vol. 8586). Springer, 207–231. https://doi.org/10.1007/978-3-662-44202-9_9
Google Scholar
Digital Library
- Ornela Dardha and Simon J. Gay. 2018. A New Linear Logic for Deadlock-Free Session-Typed Processes. In FOSSACS (LNCS, Vol. 10803). 91–109. https://doi.org/10.1007/978-3-319-89366-2_5
Google Scholar
Cross Ref
- Ornela Dardha, Elena Giachino, and Davide Sangiorgi. 2012. Session types revisited. In PPDP’12. https://doi.org/10.1145/2370776.2370794
Google Scholar
Digital Library
- Ornela Dardha, Elena Giachino, and Davide Sangiorgi. 2017. Session types revisited. Inf. Comput., 256 (2017), 253–286. https://doi.org/10.1016/j.ic.2017.06.002
Google Scholar
Digital Library
- Emanuele D’Osualdo, Julian Sutherland, Azadeh Farzan, and Philippa Gardner. 2021. TaDA Live: Compositional Reasoning for Termination of Fine-grained Concurrent Programs. TOPLAS, 43, 4 (2021), 16:1–16:134. https://doi.org/10.1145/3477082
Google Scholar
Digital Library
- Thomas Ehrhard. 2018. An Introduction to Differential Linear Logic: Proof-Nets, Models and Antiderivatives. Math. Struct. Comput. Sci., 28, 7 (2018), 995–1060. https://doi.org/10.1017/S0960129516000372
Google Scholar
Cross Ref
- Thomas Ehrhard and Laurent Regnier. 2006. Differential Interaction Nets. Theor. Comput. Sci., 364, 2 (2006), 166–195. https://doi.org/10.1016/j.tcs.2006.08.003
Google Scholar
Digital Library
- Frantisek Farka, Aleksandar Nanevski, Anindya Banerjee, Germán Andrés Delbianco, and Ignacio Fábregas. 2021. On Algebraic Abstractions for Concurrent Separation Logics. Proc. ACM Program. Lang., 5, POPL (2021), 1–32. https://doi.org/10.1145/3434286
Google Scholar
Digital Library
- Simon Fowler, Wen Kokke, Ornela Dardha, Sam Lindley, and J. Garrett Morris. 2021. Separating Sessions Smoothly. In CONCUR (LIPIcs, Vol. 203). Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 36:1–36:18. https://doi.org/10.4230/LIPIcs.CONCUR.2021.36
Google Scholar
Cross Ref
- Simon Fowler, Sam Lindley, J. Garrett Morris, and Sára Decova. 2019. Exceptional Asynchronous Session Types: Session Types Without Tiers. PACMPL, 3, POPL (2019), 28:1–28:29. https://doi.org/10.1145/3290341
Google Scholar
Digital Library
- Simon J. Gay, Peter Thiemann, and Vasco T. Vasconcelos. 2020. Duality of Session Types: The Final Cut. In PLACES (EPTCS, Vol. 314). 23–33. https://doi.org/10.4204/EPTCS.314.3
Google Scholar
Cross Ref
- Elena Giachino, Naoki Kobayashi, and Cosimo Laneve. 2014. Deadlock Analysis of Unbounded Process Networks. In CONCUR (Lecture Notes in Computer Science, Vol. 8704). Springer, 63–77. https://doi.org/10.1007/978-3-662-44584-6_6
Google Scholar
Cross Ref
- Dan Grossman, J. Gregory Morrisett, Trevor Jim, Michael W. Hicks, Yanling Wang, and James Cheney. 2002. Region-Based Memory Management in Cyclone. In PLDI. ACM, 282–293. https://doi.org/10.1145/512529.512563
Google Scholar
Digital Library
- Jafar Hamin and Bart Jacobs. 2018. Deadlock-Free Monitors. In ESOP (LNCS, Vol. 10801). 415–441. https://doi.org/10.1007/978-3-319-89884-1_15
Google Scholar
Cross Ref
- Kohei Honda. 1993. Types for Dyadic Interaction. In CONCUR (LNCS, Vol. 715). 509–523. https://doi.org/10.1007/3-540-57208-2_35
Google Scholar
Cross Ref
- Kohei Honda, Vasco Thudichum Vasconcelos, and Makoto Kubo. 1998. Language Primitives and Type Discipline for Structured Communication-Based Programming. In ESOP (LNCS, Vol. 1381). 122–138. https://doi.org/10.1007/BFb0053567
Google Scholar
Cross Ref
- Kohei Honda, Nobuko Yoshida, and Marco Carbone. 2008. Multiparty Asynchronous Session Types. In POPL. 273–284. https://doi.org/10.1145/1328438.1328472
Google Scholar
Digital Library
- Atsushi Igarashi and Naoki Kobayashi. 1997. Type-Based Analysis of Communication for Concurrent Programming Languages. In SAS (LNCS, Vol. 1302). 187–201. https://doi.org/10.1007/BFb0032742
Google Scholar
Cross Ref
- Atsushi Igarashi and Naoki Kobayashi. 2001. A Generic Type System for the Pi-calculus. In POPL. 128–141. https://doi.org/10.1145/360204.360215
Google Scholar
Digital Library
- Atsushi Igarashi and Naoki Kobayashi. 2004. A Generic Type System for the Pi-calculus. Theoretical Computer Science, 311, 1-3 (2004), 121–163. https://doi.org/10.1016/S0304-3975(03)00325-6
Google Scholar
Digital Library
- Jules Jacobs and Stephanie Balzer. 2022. Higher-Order Leak and Deadlock Free Locks (Coq mechanization). https://doi.org/10.5281/zenodo.7150549 The most recent version is at
Google Scholar
Digital Library
- Jules Jacobs, Stephanie Balzer, and Robbert Krebbers. 2022. Connectivity Graphs: A Method for Proving Deadlock Freedom Based on Separation Logic. Proc. ACM Program. Lang., 6, POPL (2022), 1–33. https://doi.org/10.1145/3498662
Google Scholar
Digital Library
- Jules Jacobs, Stephanie Balzer, and Robbert Krebbers. 2022. Multiparty GV: Functional Multiparty Session Types With Certified Deadlock Freedom. Proc. ACM Program. Lang., To appear
Google Scholar
Digital Library
- Ralf Jung, Jacques-Henri Jourdan, Robbert Krebbers, and Derek Dreyer. 2018. RustBelt: Securing the Foundations of the Rust Programming Language. PACMPL, 2, POPL (2018), 66:1–66:34. https://doi.org/10.1145/3158154
Google Scholar
Digital Library
- Ralf Jung, Robbert Krebbers, Jacques-Henri Jourdan, Ales Bizjak, Lars Birkedal, and Derek Dreyer. 2018. Iris From the Ground Up: A Modular Foundation for Higher-Order Concurrent Separation Logic. JFP, 28 (2018), e20. https://doi.org/10.1017/S0956796818000151
Google Scholar
Cross Ref
- Ralf Jung, David Swasey, Filip Sieczkowski, Kasper Svendsen, Aaron Turon, Lars Birkedal, and Derek Dreyer. 2015. Iris: Monoids and Invariants as an Orthogonal Basis for Concurrent Reasoning. In POPL. 637–650. https://doi.org/10.1145/2676726.2676980
Google Scholar
Digital Library
- Naoki Kobayashi. 1997. A Partially Deadlock-Free Typed Process Calculus. In LICS. 128–139. https://doi.org/10.1109/LICS.1997.614941
Google Scholar
Cross Ref
- Naoki Kobayashi. 2002. A Type System for Lock-Free Processes. I&C, 177, 2 (2002), 122–159. https://doi.org/10.1006/inco.2002.3171
Google Scholar
Cross Ref
- Naoki Kobayashi. 2002. Type Systems for Concurrent Programs. Lecture Notes in Computer Science, Vol. 2757. 439–453. https://doi.org/10.1007/978-3-540-40007-3_26
Google Scholar
Cross Ref
- Naoki Kobayashi. 2005. Type-Based Information Flow Analysis for the Pi-Calculus. Acta Informatica, 42, 4-5 (2005), 291–347. https://doi.org/10.1007/s00236-005-0179-x
Google Scholar
Cross Ref
- Naoki Kobayashi. 2006. A New Type System for Deadlock-Free Processes. In CONCUR (LNCS, Vol. 4137). 233–247. https://doi.org/10.1007/11817949_16
Google Scholar
Digital Library
- Naoki Kobayashi and Cosimo Laneve. 2017. Deadlock Analysis of Unbounded Process Networks. Inf. Comput., 252 (2017), 48–70. https://doi.org/10.1016/j.ic.2016.03.004
Google Scholar
Digital Library
- Naoki Kobayashi, Benjamin C. Pierce, and David N. Turner. 1999. Linearity and the pi-calculus. TOPLAS, 21, 5 (1999), 914–947. https://doi.org/10.1145/330249.330251
Google Scholar
Digital Library
- Naoki Kobayashi, Shin Saito, and Eijiro Sumii. 2000. An Implicitly-Typed Deadlock-Free Process Calculus. In CONCUR (LNCS, Vol. 1877). 489–503. https://doi.org/10.1007/3-540-44618-4_35
Google Scholar
Cross Ref
- Wen Kokke and Ornela Dardha. 2021. Prioritise the Best Variation. In FORTE (LNCS, Vol. 12719). Springer, 100–119. https://doi.org/10.1007/978-3-030-78089-0_6
Google Scholar
Digital Library
- Wen Kokke, Fabrizio Montesi, and Marco Peressotti. 2019. Better Late Than Never: a Fully-Abstract Semantics for Classical Processes. PACMPL, 3, POPL (2019), 24:1–24:29. https://doi.org/10.1145/3290337
Google Scholar
Digital Library
- Robbert Krebbers, Amin Timany, and Lars Birkedal. 2017. Interactive Proofs in Higher-Order Concurrent Separation Logic. In POPL. 205–217. https://doi.org/10.1145/3009837.3009855
Google Scholar
Digital Library
- K. Rustan M. Leino, Peter Müller, and Jan Smans. 2010. Deadlock-Free Channels and Locks. In ESOP (Lecture Notes in Computer Science, Vol. 6012). Springer, 407–426. https://doi.org/10.1007/978-3-642-11957-6_22
Google Scholar
Digital Library
- Sam Lindley and J. Garrett Morris. 2015. A Semantics for Propositions as Sessions. In ESOP (LNCS, Vol. 9032). 560–584. https://doi.org/10.1007/978-3-662-46669-8_23
Google Scholar
Cross Ref
- Sam Lindley and J. Garrett Morris. 2016. Talking Bananas: Structural Recursion For Session Types. In ICFP. 434–447. https://doi.org/10.1145/2951913.2951921
Google Scholar
Digital Library
- Sam Lindley and J. Garrett Morris. 2017. Lightweight Functional Session Types. In Behavioural Types: from Theory to Tools.
Google Scholar
- Nicholas D. Matsakis and Felix S. Klock. 2014. The Rust language. In HILT. ACM, 103–104. https://doi.org/10.1145/2663171.2663188
Google Scholar
Digital Library
- Peter Müller. 2002. Modular Specification and Verification of Object-Oriented Programs (Lecture Notes in Computer Science, Vol. 2262). Springer. isbn:3-540-43167-5 https://doi.org/10.1007/3-540-45651-1
Google Scholar
Cross Ref
- Aleksandar Nanevski, Anindya Banerjee, Germán Andrés Delbianco, and Ignacio Fábregas. 2019. Specifying Concurrent Programs in Separation Logic: Morphisms and Simulations. Proc. ACM Program. Lang., 3, OOPSLA (2019), 161:1–161:30. https://doi.org/10.1145/3360587
Google Scholar
Digital Library
- Luca Padovani. 2014. Deadlock and lock freedom in the linear π -calculus. In LICS. ACM, 72:1–72:10. https://doi.org/10.1145/2603088.2603116
Google Scholar
Digital Library
- Zesen Qian, G. A. Kavvos, and Lars Birkedal. 2021. Client-Server Sessions in Linear Logic. Proc. ACM Program. Lang., 5, ICFP (2021), 1–31. https://doi.org/10.1145/3473567
Google Scholar
Digital Library
- Pedro Rocha and Luís Caires. 2021. Propositions-as-Types and Shared State. Proc. ACM Program. Lang., 5, ICFP (2021), 1–30. https://doi.org/10.1145/3473584
Google Scholar
Digital Library
- Mads Tofte and Jean-Pierre Talpin. 1997. Region-based Memory Management. Inf. Comput., 132, 2 (1997), 109–176. https://doi.org/10.1006/inco.1996.2613
Google Scholar
Digital Library
- Bernardo Toninho. 2015. A Logical Foundation for Session-Based Concurrent Computation. Ph. D. Dissertation. Carnegie Mellon University and New University of Lisbon.
Google Scholar
- Bernardo Toninho, Luís Caires, and Frank Pfenning. 2013. Higher-Order Processes, Functions, and Sessions: A Monadic Integration. In ESOP (LNCS, Vol. 7792). 350–369. https://doi.org/10.1007/978-3-642-37036-6_20
Google Scholar
Digital Library
- Philip Wadler. 2012. Propositions as Sessions. In ICFP. 273–286. https://doi.org/10.1145/2364527.2364568
Google Scholar
Digital Library
Index Terms
Higher-Order Leak and Deadlock Free Locks
Recommendations
Static lock capabilities for deadlock freedom
TLDI '12: Proceedings of the 8th ACM SIGPLAN workshop on Types in language design and implementationWe present a technique --- lock capabilities --- for statically verifying that multithreaded programs with locks will not deadlock. Most previous work on deadlock prevention requires a strict total order on all locks held simultaneously by a thread, but ...
Compositional deadlock detection for rendezvous communication
EMSOFT '09: Proceedings of the seventh ACM international conference on Embedded softwareConcurrent programming languages are growing in importance with the advent of multi-core systems. However, concurrent programs suffer from problems, such as data races and deadlock, absent from sequential programs. Unfortunately, traditional race and ...
Inferring locks for atomic sections
PLDI '08: Proceedings of the 29th ACM SIGPLAN Conference on Programming Language Design and ImplementationAtomic sections are a recent and popular idiom to support the development of concurrent programs. Updates performed within an atomic section should not be visible to other threads until the atomic section has been executed entirely. Traditionally, ...






Comments