skip to main content
10.1145/1190216.1190260acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
Article

Lock allocation

Published:17 January 2007Publication History

ABSTRACT

We introduce lock allocation, an automatic technique that takes a multi-threaded program annotated with atomic sections (that must be executed atomically), and infers a lock assignment from global variables to locks and a lock instrumentation that determines where each lock should be acquired and released such that the resulting instrumented program is guaranteed to preserve atomicity and deadlock freedom (provided all shared state is accessed only within atomic sections). Our algorithm works in the presence of pointers and procedures, and sets up the lock allocation problem as a 0-1 ILP which minimizes the conflict cost between atomic sections while simultaneously minimizing the number of locks. We have implemented our algorithm for both C with pthreads and Java, and have applied it to infer locks in 15K lines of AOLserver code. Our automatic allocation produces the same results as hand annotations for most of this code, while solving the optimization instances within a second for most programs.

References

  1. L.O. Andersen. Program analysis and specialization for the C programming language. PhD thesis, 1994.Google ScholarGoogle Scholar
  2. Aolserver. http://www.aolserver.com.Google ScholarGoogle Scholar
  3. E.M.L. Beale and J.A. Tomlin. Special facilities in a general mathematical programming system for non-convex problems using ordered sets of variables. In Proc. Intl. Conf. Oper. Res., pages 447--454, 1970. Tavistock.Google ScholarGoogle Scholar
  4. N. Een and N. Sorensson. Translating pseudo-boolean constraints into SAT. JSAT, pages 1--26, 2006.Google ScholarGoogle Scholar
  5. C. Flanagan and S.N. Freund. Type-based race detection for Java. In PLDI 00, pages 219--232. ACM, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. C. Flanagan, S.N. Freund, and M. Lifshin. Type inference for atomicity. In TLDI 05, pages 47--58. ACM, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. C. Flanagan and S. Qadeer. A type and effect system for atomicity. In PLDI 03, pages 338--349. ACM, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. J. Gray and A. Reuter. Transaction processing: Concepts and Techniques. Morgan-Kaufmann, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. T. Harris and K. Fraser. Language support for lightweight transactions. In OOPSLA 03, pages 388--402, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. M. Hicks, J.S. Foster, and P. Pratikakis. Lock inference for atomic sections. In TRANSACT '06, 2006.Google ScholarGoogle Scholar
  11. G. Holzmann. The Spin model checker. IEEE TSE, 23(5):279--295, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. S. Jagannathan and J. Vitek. Optimistic concurrency semantics for transactions in coordination languages. In Intl. Conf. on Coordination Models and Languages, LNCS 2949, pages 183--198. Springer, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  13. D. B. Lomet. Process structuring, synchronization, and recovery using atomic actions. In Language Design for Reliable Software, pages 128--137, 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. B. McCloskey, F. Zhou, D. Gay, and E. Brewer. Autolocker: Synchronization inference for atomic sections. In POPL 06, pages 346--358. ACM, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. G. Naumovich, G.S. Avrunin, and L.A. Clarke. An efficient algorithm for computing MHP information for concurrent Java programs. In FSE 99, pages 338--354. ACM, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. G. Necula, S. McPeak, S. Rahul, and W. Weimer. CIL: Intermediate Language and Tools for Analysis and Transformation of C Programs. In CC '02, pages 213--228, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. N. Nystrom, M. Clarkson, and A. Myers. Polyglot: An Extensible Compiler Framework for Java. In CC '03, pages 138--152, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. M.F. Ringenburg and D. Grossman. Atomcaml: first-class atomicity via rollback. In ICFP 05, pages 92--104. ACM, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. S. Savage, M. Burrows, C.G. Nelson, P. Sobalvarro, and T.A. Anderson. Eraser: A dynamic data race detector for multithreaded programs. ACM TOCS, 15(4):391--411, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. N. Sterling. Warlock: a static data race analysis tool. In USENIX Technical Conference, pages 97--106, 1993.Google ScholarGoogle Scholar

Index Terms

  1. Lock allocation

    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
      POPL '07: Proceedings of the 34th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
      January 2007
      400 pages
      ISBN:1595935754
      DOI:10.1145/1190216
      • cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 42, Issue 1
        Proceedings of the 2007 POPL Conference
        January 2007
        379 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/1190215
        Issue’s Table of Contents

      Copyright © 2007 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: 17 January 2007

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • Article

      Acceptance Rates

      Overall Acceptance Rate824of4,130submissions,20%

      Upcoming Conference

      POPL '25

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader