skip to main content
research-article

Transactional events for ML

Published:20 September 2008Publication History
Skip Abstract Section

Abstract

Transactional events (TE) are an approach to concurrent programming that enriches the first-class synchronous message-passing of Concurrent ML (CML) with a combinator that allows multiple messages to be passed as part of one all-or-nothing synchronization. Donnelly and Fluet (2006) designed and implemented TE as a Haskell library and demonstrated that it enables elegant solutions to programming patterns that are awkward or impossible in CML. However, both the definition and the implementation of TE relied fundamentally on the code in a synchronization not using mutable memory, an unreasonable assumption for mostly functional languages like ML where functional interfaces may have impure implementations.

We present a definition and implementation of TE that supports ML-style references and nested synchronizations, both of which were previously unnecessary due to Haskell's more restrictive type system. As in prior work, we have a high-level semantics that makes nondeterministic choices such that synchronizations succeed whenever possible and a low-level semantics that uses search to implement the high-level semantics soundly and completely. The key design trade-off in the semantics is to allow updates to mutable memory without requiring the implementation to consider all possible thread interleavings. Our solution uses first-class heaps and allows interleavings only when a message is sent or received. We have used Coq to prove the high- and low-level semantics equivalent.

We have implemented our approach by modifying the Objective Caml run-time system. By modifying the run-time system, rather than relying solely on a library, we can eliminate the potential for nonterminating computations within unsuccessful synchronizations to run forever.

Skip Supplemental Material Section

Supplemental Material

Video

References

  1. Joe Armstrong, Robert Virding, ClaesWikström, and Mike Williams. Concurrent Programming in Erlang. Prentice-Hall, 2nd edition, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Kevin Donnelly and Matthew Fluet. Transactional events. The Journal of Functional Programming, 2008. To appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Kevin Donnelly and Matthew Fluet. Transactional events. In 11th ACM International Conference on Functional Programming, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Matthew Flatt and Robert Bruce Findler. Kill-safe synchronization abstractions. In ACM Conference on Programming Language Design and Implementation, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Tim Harris and Keir Fraser. Language support for lightweight transactions. In ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Tim Harris, Simon Marlow, Simon Peyton Jones, and Maurice Herlihy. Composable memory transactions. In ACM Symposium on Principles and Practice of Parallel Programming, 2005a. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Tim Harris, Simon Marlow, and Simon Peyton Jones. Haskell on a shared-memory multiprocessor. In Proceedings of the 2005 ACM SIGPLAN Workshop on Haskell, 2005b. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. C. A. R. Hoare. Communicating sequential processes. Commun. ACM, 21 (8), 1978. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Suresh Jagannathan, Jan Vitek, Adam Welc, and Antony L. Hosking. A transactional object calculus. Science of Computer Programming, 57(2), 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Alan Jeffrey. A fully abstract semantics for a concurrent functional language with monadic types. In The Symposium on Logic in Computer Science, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Aaron Kimball and Dan Grossman. Software transactions meet first-class continuations. In 8th Annual Workshop on Scheme and Functional Programming, 2007.Google ScholarGoogle Scholar
  12. Xavier Leroy. The Objective Caml system release 3.10, Event module, 2007. http://caml.inria.fr/pub/docs/manual-ocaml/libref/Event.html.Google ScholarGoogle Scholar
  13. Katherine F. Moore and Dan Grossman. High-level small-step operational semantics for transactions. In 35th ACM Symposium on Principles of Programming Languages, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Prakash Panangaden and John Reppy. The essence of Concurrent ML. In Flemming Nielson, editor, ML with Concurrency: Design, Analysis, Implementation, and Application, Springer Monographs in Computer Science. Springer-Verlag, 1997.Google ScholarGoogle Scholar
  15. John Reppy. Concurrent Programming in ML. Cambridge University Press, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. John Reppy and Yingqi Xiao. Specialization of CML message-passing primitives. In 34th ACM Symposium on Principles of Programming Languages, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. John Reppy and Yinqi Xiao. Toward a parallel implementation of Concurrent ML. In Workshop on Declarative Aspects of Multicore Programming, 2008.Google ScholarGoogle Scholar
  18. Michael F. Ringenburg and Dan Grossman. AtomCaml: First-class atomicity via rollback. In 10th ACM International Conference on Functional Programming, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. George Russell. Events in Haskell, and how to implement them. In 6th ACM International Conference on Functional Programming, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Yannis Smaragdakis, Anthony Kay, Reimer Behrends, and Michal Young. Transactions with isolation and cooperation. In ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Lukasz Ziarek and Suresh Jagannathan. Memoizing multi-threaded transactions. In Workshop on Declarative Aspects of Multicore Programming, 2008.Google ScholarGoogle Scholar
  22. Lukasz Ziarek, Philip Schatz, and Suresh Jagannathan. Stabilizers: A modular checkpointing abstraction for concurrent functional programs. In 11th ACM International Conference on Functional Programming, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Transactional events for ML

        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 43, Issue 9
          ICFP '08
          September 2008
          399 pages
          ISSN:0362-1340
          EISSN:1558-1160
          DOI:10.1145/1411203
          Issue’s Table of Contents
          • cover image ACM Conferences
            ICFP '08: Proceedings of the 13th ACM SIGPLAN international conference on Functional programming
            September 2008
            422 pages
            ISBN:9781595939197
            DOI:10.1145/1411204

          Copyright © 2008 ACM

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 20 September 2008

          Check for updates

          Qualifiers

          • research-article

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!