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.
Supplemental Material
Available for Download
Supplemental material for: Transactional events for ML
- Joe Armstrong, Robert Virding, ClaesWikström, and Mike Williams. Concurrent Programming in Erlang. Prentice-Hall, 2nd edition, 1996. Google Scholar
Digital Library
- Kevin Donnelly and Matthew Fluet. Transactional events. The Journal of Functional Programming, 2008. To appear. Google Scholar
Digital Library
- Kevin Donnelly and Matthew Fluet. Transactional events. In 11th ACM International Conference on Functional Programming, 2006. Google Scholar
Digital Library
- Matthew Flatt and Robert Bruce Findler. Kill-safe synchronization abstractions. In ACM Conference on Programming Language Design and Implementation, 2004. Google Scholar
Digital Library
- Tim Harris and Keir Fraser. Language support for lightweight transactions. In ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, 2003. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- C. A. R. Hoare. Communicating sequential processes. Commun. ACM, 21 (8), 1978. Google Scholar
Digital Library
- Suresh Jagannathan, Jan Vitek, Adam Welc, and Antony L. Hosking. A transactional object calculus. Science of Computer Programming, 57(2), 2005. Google Scholar
Digital Library
- Alan Jeffrey. A fully abstract semantics for a concurrent functional language with monadic types. In The Symposium on Logic in Computer Science, 1995. Google Scholar
Digital Library
- Aaron Kimball and Dan Grossman. Software transactions meet first-class continuations. In 8th Annual Workshop on Scheme and Functional Programming, 2007.Google Scholar
- Xavier Leroy. The Objective Caml system release 3.10, Event module, 2007. http://caml.inria.fr/pub/docs/manual-ocaml/libref/Event.html.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
- John Reppy. Concurrent Programming in ML. Cambridge University Press, 1999. Google Scholar
Digital Library
- John Reppy and Yingqi Xiao. Specialization of CML message-passing primitives. In 34th ACM Symposium on Principles of Programming Languages, 2007. Google Scholar
Digital Library
- John Reppy and Yinqi Xiao. Toward a parallel implementation of Concurrent ML. In Workshop on Declarative Aspects of Multicore Programming, 2008.Google Scholar
- Michael F. Ringenburg and Dan Grossman. AtomCaml: First-class atomicity via rollback. In 10th ACM International Conference on Functional Programming, 2005. Google Scholar
Digital Library
- George Russell. Events in Haskell, and how to implement them. In 6th ACM International Conference on Functional Programming, 2001. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Lukasz Ziarek and Suresh Jagannathan. Memoizing multi-threaded transactions. In Workshop on Declarative Aspects of Multicore Programming, 2008.Google Scholar
- 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 Scholar
Digital Library
Index Terms
Transactional events for ML
Recommendations
Transactional events
Proceedings of the 2006 ICFP conferenceConcurrent programs require high-level abstractions in order to manage complexity and enable compositional reasoning. In this paper, we introduce a novel concurrency abstraction, dubbed transactional events, which combines first-class synchronous ...
Transactional events for ML
ICFP '08: Proceedings of the 13th ACM SIGPLAN international conference on Functional programmingTransactional 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 ...
Transactional events
ICFP '06: Proceedings of the eleventh ACM SIGPLAN international conference on Functional programmingConcurrent programs require high-level abstractions in order to manage complexity and enable compositional reasoning. In this paper, we introduce a novel concurrency abstraction, dubbed transactional events, which combines first-class synchronous ...







Comments