skip to main content
10.1145/2103786.2103796acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

Static lock capabilities for deadlock freedom

Published:28 January 2012Publication History

ABSTRACT

We 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 such an invariant often does not hold with fine-grained locking, especially when data-structure mutations change the order locks are acquired. Lock capabilities support idioms that use fine-grained locking, such as mutable binary trees, circular lists, and arrays where each element has a different lock.

Lock capabilities do not enforce a total order and do not prevent external references to data-structure nodes. Instead, the technique reasons about static capabilities, where a thread already holding locks can attempt to acquire another lock only if its capabilities allow it. Acquiring one lock may grant a capability to acquire further locks; in data-structures where heap shape affects safe locking orders, the heap structure can induce the capability-granting relation. Deadlock-freedom follows from ensuring that the capability-granting relation is acyclic. Where necessary, we restrict aliasing with a variant of unique references to allow strong updates to the capability-granting relation, while still allowing other aliases that are used only to acquire locks while holding no locks.

We formalize our technique as a type-and-effect system, demonstrate it handles realistic challenging idioms, and use syntactic techniques (type preservation) to show it soundly prevents deadlock.

References

  1. H. Attiya, G. Ramalingam, and N. Rinetzky. Sequential Verification of Serializability. In POPL, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. K. Bierhoff and J. Aldrich. Modular Typestate Checking of Aliased Objects. In OOPSLA, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. R. Bornat, C. Calcagno, P. O'Hearn, and M. Parkinson. Permission Accounting in Separation Logic. In POPL, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. G. Boudol. A Deadlock-Free Semantics for Shared Memory Concurrency. In ICTAC, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. C. Boyapati, R. Lee, and M. Rinard. Ownership Types for Safe Programming: Preventing Data Races and Deadlocks. In OOPSLA, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. J. Boyland. Checking Interference with Fractional Permissions. In SAS, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. M. Bravenboer and Y. Smaragdakis. Strictly Declarative Specification of Sophisticated Points-to Analyses. In OOPSLA, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. V. K. Chaudhri and V. Hadzilacos. Safe Locking Policies for Dynamic Databases. In PODS, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. C. Flanagan and M. Abadi. Types for Safe Locking. In ESOP, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. C. Flanagan and S. N. Freund. Type-Based Race Detection for Java. In PLDI, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. P. Gerakios, N. Papaspyrou, and K. Sagonas. A Type System for Unstructured Locking that Guarantees Deadlock Freedom without Imposing a Lock Ordering. In PLACES, 2010.Google ScholarGoogle Scholar
  12. P. Gerakios, N. Papaspyrou, and K. Sagonas. A Type and Effect System for Deadlock Avoidance in Low-level Languages. In TLDI, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. C. S. Gordon, M. D. Ernst, and D. Grossman. Static Lock Capabilities for Deadlock Freedom. Technical Report UW-CSE-11--10-01, Computer Science and Engineering, University of Washington, Seattle, WA, USA, 2011.Google ScholarGoogle Scholar
  14. P. Haller and M. Odersky. Capabilities for Uniqueness and Borrowing. In ECOOP, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. N. Kobayashi. A New Type System for Deadlock-Free Processes. In CONCUR, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. K. R. Leino and P. Müller. A Basis for Verifying Multi-threaded Programs. In ESOP, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. K. R. Leino, P. Müller, and J. Smans. Deadlock-free Channels and Locks. In ESOP, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. F. Smith, D. Walker, and J. G. Morrisett. Alias Types. In ESOP, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. D. Walker and G. Morrisett. Alias Types for Recursive Data Structures. In TIC, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. D. Walker, K. Crary, and G. Morrisett. Typed Memory Management via Static Capabilities. ACM TOPLAS, 22, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Y. Wang, T. Kelly, M. Kudlur, S. Lafortune, and S. Mahlke. Gadara: Dynamic Deadlock Avoidance for Multithreaded Programs. In OSDI, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Y. Wang, S. Lafortune, T. Kelly, M. Kudlur, and S. Mahlke. The Theory of Deadlock Avoidance via Discrete Control. In POPL, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Static lock capabilities for deadlock freedom

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in
        • Published in

          cover image ACM Conferences
          TLDI '12: Proceedings of the 8th ACM SIGPLAN workshop on Types in language design and implementation
          January 2012
          110 pages
          ISBN:9781450311205
          DOI:10.1145/2103786

          Copyright © 2012 ACM

          Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 28 January 2012

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • research-article

          Acceptance Rates

          Overall Acceptance Rate11of26submissions,42%

          Upcoming Conference

          POPL '25

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader