skip to main content
article

AtomCaml: first-class atomicity via rollback

Published:12 September 2005Publication History
Skip Abstract Section

Abstract

We have designed, implemented, and evaluated AtomCaml, an extension to Objective Caml that provides a synchronization primitive for atomic (transactional) execution of code. A first-class primitive function of type (unit->'a)->'a evaluates its argument (which may call other functions, even external C functions) as though no other thread has interleaved execution. Our design ensures fair scheduling and obstruction-freedom. Our implementation extends the Objective Caml bytecode compiler and run-time system to support atomicity. A logging-and-rollback approach lets us undo uncompleted atomic blocks upon thread pre-emption, and retry them when the thread is rescheduled. The mostly functional nature of the Caml language and the Objective Caml implementation's commitment to a uniprocessor execution model (i.e., threads are interleaved, not executed simultaneously) allow particularly efficient logging. We have evaluated the efficiency and ease-of-use of AtomCaml by writing libraries and microbenchmarks, writing a small application, and replacing all locking with atomicity in an existing, large multithreaded application. Our experience indicates the performance overhead is negligible, atomic helps avoid synchronization mistakes, and idioms such as condition variables adapt reasonably to the atomic approach.

References

  1. AtomCAML. http://www.cs.washington.edu/homes/miker/atomcaml.]]Google ScholarGoogle Scholar
  2. David Bacon, Robert Storm, and Ashis Tarafdar. Guava: A dialect of Java without data races. In ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, pages 382--400, October 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Brian N. Bershad, David D. Redell, and John R. Ellis. Fast mutual exclusion for uniprocessors. In 5th International Conference on Architectural Support for Programming Languages and Operating Systems, pages 223--233, 1992.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Chandrasekhar Boyapati, Robert Lee, and Martin Rinard. Ownership types for safe programming: Preventing data races and deadlocks. In ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, pages 211--230, November 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Chandrasekhar Boyapati and Martin Rinard. A parameterized type system for race-free Java programs. In ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, pages 56--59, October 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Greg Bronevetsky, Daniel Marques, Keshav Pingali, Peter Szwed, and Martin Schulz. Application-level checkpointing for shared memory programs. In International Conference on Architectural Support for Programming Languages and Operating Systems, pages 235--247, 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Guang-Ien Cheng, Mingdong Feng, Charles E. Leiserson, Keith H. Randall, and Andrew F. Stark. Detecting data races in Cilk programs that use locks. In ACM Symposium on Parallel Algorithms and Architectures, pages 298--309, June 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Jong-Deok Choi, Keunwoo Lee, Alexey Loginov, Robert O'Callahan, Vivek Sarkar, and Manu Sridharan. Efficient and precise datarace detection for multithreaded object-oriented programs. In ACM Conference on Programming Language Design and Implementation, pages 258--269, June 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Cormac Flanagan and Martín Abadi. Types for safe locking. In European Symposium on Programming, volume 1576 of Lecture Notes in Computer Science, pages 91--108. Springer-Verlag, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Cormac Flanagan and Stephen N. Freund. Type-based race detection for Java. In ACM Conference on Programming Language Design and Implementation, pages 219--232, 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Cormac Flanagan and Stephen N. Freund. Atomizer: A dynamic atomicity checker for multithreaded programs. In ACM Symposium on Principles of Programming Languages, pages 256--267, 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Cormac Flanagan, K. Rustan M. Leino, Mark Lillibridge, Greg Nelson, James B. Saxe, and Raymie Stata. Extended static checking for Java. In ACM Conference on Programming Language Design and Implementation, pages 234--245, 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Cormac Flanagan and Shaz Qadeer. A type and effect system for atomicity. In ACM Conference on Programming Language Design and Implementation, pages 338--349, June 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Cormac Flanagan and Shaz Qadeer. Types for atomicity. In ACM International Workshop on Types in Language Design and Implementation, pages 1--12, January 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Matthew Flatt and Robert Bruce Findler. Kill-safe synchronization abstractions. In ACM Conference on Programming Language Design and Implementation, pages 47--58, Washington DC, June 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Lance Hammond, Brian D. Carlstrom, Vicky Wong, Ben Hertzberg, Mike Chen, Christos Kozyrakis, and Kunle Olukotun. Programming with transactional coherence and consistency (tcc). In International Conference on Architectural Support for Programming Languages and Operating Systems, pages 1--13, 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Tim Harris. Exceptions and side-effects in atomic blocks. In PODC Workshop on Concurrency and Synchronization in Java Programs, July 2004.]]Google ScholarGoogle Scholar
  18. Tim Harris and Keir Fraser. Language support for lightweight transactions. In ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, pages 388--402, October 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Tim Harris, Simon Marlow, Simon Peyton Jones, and Maurice Herlihy. Composable memory transactions. In ACM Symposium on Principles and Practice of Parallel Programming, 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Maurice Herlihy, Victor Luchangco, Mark Moir, and William N. Scherer III. Software transactional memory for dynamic-sized data structures. In ACM Symposium on Principles of Distributed Computing, pages 92--101, 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Michael Hicks, Pankaj Kakkar, Jonathan T. Moore, Carl A. Gunter, and Scott Nettles. PLAN: A packet language for active networks. In ACM SIGPLAN International Conference on Functional Programming Languages (ICFP), pages 86--93, 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Michael Hicks, Jonathan T. Moore, D. Scott Alexander, Carl A. Gunter, and Scott M. Nettles. PLANet: An active internetwork. In IEEE Computer and Communication Society INFOCOM Conference, pages 1124--1133, 1999.]]Google ScholarGoogle ScholarCross RefCross Ref
  23. Richard J. Lipton. Reduction: a method of proving properties of parallel programs. Communications of the ACM, 18(12):717--721, December 1975.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Barbara Liskov and Robert Scheifler. Guardians and actions: Linguistic support for robust, distributed programs. ACM Transactions on Programming Languages and Systems, 5(3):381--404, 1983.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Jeremy Manson, Jason Baker, Antonio Cunei, Suresh Jagannathan, Marek Prochazka, Jan Vitek, and Bin Xin. Preemptible atomic regions for Real-time Java. Technical report, Purdue University, 2005.]]Google ScholarGoogle Scholar
  26. V. Krishna Nandivada and Suresh Jagannathan. Dynamic state restoration using versioning exceptions. Higher-Order and Symbolic Computation. To appear.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Ravi Rajwar and James R. Goodman. Transactional lock-free execution of lock-based programs. In 10th International Conference on Architectural Support for Programming Languages and Operating Systems, pages 5-17, San Jose, CA, October 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. John H. Reppy. Concurrent Programming in ML. Cambridge University Press, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Michael F. Ringenburg and Dan Grossman. Types for describing coordinated data structures. In ACM International Workshop on Types in Language Design and Implementation, pages 25--36, January 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Algis Rudys and Dan S.Wallach. Transactional rollback for languagebased systems. In International Conference on Dependable Systems and Networks, June 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Stefan Savage, Michael Burrows, Greg Nelson, Patrick Sobalvarro, and Thomas Anderson. Eraser: A dynmaic data race detector for multithreaded programs. ACM Transactions on Computer Systems, 15(4):391--411, 1997.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. February 27, 2005. http://www.securityfocus.com/.]]Google ScholarGoogle Scholar
  33. Nir Shavit and Dan Touitou. Software transactional memory. Distributed Computing, Special Issue(10):99--116, 1997.]]Google ScholarGoogle Scholar
  34. Avraham Shinnar, David Tarditi, Mark Plesko, and Bjarne Steensgaard. Integrating support for undo with exception handling. Technical Report MSR-TR -2004-140, Microsoft Research, December 2004.]]Google ScholarGoogle Scholar
  35. Olin Shivers, James W. Clark, and Roland McGrath. Atomic heap transactions and fine-grain interrupts. In ACM International Conference on Functional Programming, pages 48--59, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Andrew P. Tolmach and Andrew W. Appel. A debugger for standard ML. Journal of Functional Programming, 5(2):155--200, 1995.]]Google ScholarGoogle ScholarCross RefCross Ref
  37. February 27, 2005. http://www.us-cert.gov/.]]Google ScholarGoogle Scholar
  38. Christoph von Praun and Thomas R. Gross. Object race detection. In ACM Conference on Object Oriented Programming, Systems, Languages, and Applications, pages 70--82, October 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Adam Welc, Antony L. Hosking, and Suresh Jagannathan. Preemption-based avoidance of priority inversion for Java. In International Conference on Parallel Processing, 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Adam Welc, Suresh Jagannathan, and Antony L. Hosking. Transactional monitors for concurrent objects. In European Conference on Object-Oriented Programming, 2004.]]Google ScholarGoogle ScholarCross RefCross Ref
  41. Jeannette M. Wing, Manuel Fähndrich, J. Gregory Morrisett, and Scott Nettles. Extensions to standard ML to support transactions. In ACM SIGPLAN Workshop on ML and its Applications, 1992.]]Google ScholarGoogle Scholar

Index Terms

  1. AtomCaml: first-class atomicity via rollback

    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

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 40, Issue 9
      Proceedings of the tenth ACM SIGPLAN international conference on Functional programming
      September 2005
      330 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/1090189
      Issue’s Table of Contents
      • cover image ACM Conferences
        ICFP '05: Proceedings of the tenth ACM SIGPLAN international conference on Functional programming
        September 2005
        342 pages
        ISBN:1595930647
        DOI:10.1145/1086365

      Copyright © 2005 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: 12 September 2005

      Check for updates

      Qualifiers

      • article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader