Abstract
Programmers often combine different concurrency models in a single program, in each part of the program using the model that fits best. Many programming languages, such as Clojure, Scala, and Java, cater to this need by supporting different concurrency models. However, existing programming languages often combine concurrency models in an ad hoc way, and the semantics of the combinations are not always well defined.
This article studies the combination of three concurrency models: futures, transactions, and actors. We show that a naive combination of these models invalidates the guarantees they normally provide, thereby breaking the assumptions of programmers. Hence, we present Chocola: a unified language of futures, transactions, and actors that maintains the guarantees of all three models wherever possible, even when they are combined.
We describe and formalize the semantics of this language and prove the guarantees it provides. We also provide an implementation as an extension of Clojure and demonstrated that it can improve the performance of three benchmark applications for relatively little effort from the developer.
- Gul A. Agha. 1985. Actors: A Model of Concurrent Computation in Distributed Systems. Ph.D. Dissertation. Massachusetts Institute of Technology.Google Scholar
- Gul A. Agha, Ian A. Mason, Scott F. Smith, and Carolyn L. Talcott. 1997. A foundation for actor computation. J. Funct. Prog. 7, 1 (1997), 1--72.Google ScholarDigital Library
- Kunal Agrawal, Jeremy T. Fineman, and Jim Sukha. 2008. Nested parallelism in transactional memory. In Proceedings of the 13th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP’08). 163--174. DOI:DOI: https://doi.org/10.1145/1345206.1345232.Google ScholarDigital Library
- Woongki Baek, Nathan Bronson, Christos Kozyrakis, and Kunle Olukotun. 2010. Implementing and evaluating nested parallel transactions in software transactional memory. In Proceedings of the 22nd ACM Symposium on Parallelism in Algorithms and Architectures (SPAA’10). 253--262. DOI:DOI: https://doi.org/10.1145/1810479.1810528.Google ScholarDigital Library
- Henry C. Baker and Carl Hewitt. 1977. The incremental garbage collection of processes. In Proceedings of the Symposium on Artificial Intelligence and Programming Languages. 55--59. DOI:DOI: https://doi.org/10.1145/800228.806932.Google ScholarDigital Library
- João Barreto, Aleksandar Dragojević, Paulo Ferreira, Rachid Guerraoui, and Michal Kapalka. 2010. Leveraging parallel nesting in transactional memory. In Proceedings of the 15th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP’10). 10. DOI:DOI: https://doi.org/10.1145/1693453.1693466.Google ScholarDigital Library
- Edd Barrett, Carl Friedrich Bolz-Tereick, Rebecca Killick, Sarah Mount, and Laurence Tratt. 2017. Virtual machine warmup blows hot and cold. Proc. ACM Prog. Lang. 1, OOPSLA (Oct. 2017).Google ScholarDigital Library
- Catriel Beeri, Philip A. Bernstein, and Nathan Goodman. 1989. A model for concurrency in nested transactions systems. J. ACM 36, 2 (Apr. 1989), 230--269. DOI:DOI: https://doi.org/10.1145/62044.62046.Google ScholarDigital Library
- Hal Berenson, Phil Bernstein, Jim Gray, Jim Melton, Elizabeth O’Neil, and Patrick O’Neil. 1995. A critique of ANSI SQL isolation levels. In Proceedings of the ACM SIGMOD International Conference on Management of Data (SIGMOD’95). 1--10. DOI:DOI: https://doi.org/10.1145/223784.223785.Google ScholarDigital Library
- Philip A. Bernstein and Nathan Goodman. 1981. Concurrency control in distributed database systems. Comput. Surv. 13, 2 (June 1981), 185--221. DOI:DOI: https://doi.org/10.1145/356842.356846.Google ScholarDigital Library
- Robert D. Blumofe, Christopher F. Joerg, Bradley C. Kuszmaul, Charles E. Leiserson, Keith H. Randall, and Yuli Zhou. 1995. Cilk: An efficient multithreaded runtime system. In Proceedings of the 5th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPOPP’95). 207--216. DOI:DOI: https://doi.org/10.1145/209936.209958.Google ScholarDigital Library
- Robert L. Bocchino, Vikram S. Adve, Sarita V. Adve, and Marc Snir. 2009. Parallel programming must be deterministic by default. In Proceedings of the 1st USENIX Conference on Hot Topics in Parallelism (HotPar’09).Google ScholarDigital Library
- Stephan Brandauer, Elias Castegren, Dave Clarke, Kiko Fernandez-Reyes, Einar Broch Johnsen, Ka I. Pun, S. Lizeth Tapia Tarifa, Tobias Wrigstad, and Albert Mingkun Yang. 2015. Parallel objects for multicores: A glimpse at the parallel language encore. In Proceedings of the 15th International School on Formal Methods for the Design of Computer, Communication, and Software Systems (SFM’15). 1--56.Google Scholar
- Zoran Budimlić, Michael Burke, Vincent Cavé, Kathleen Knobe, Geoff Lowney, Ryan Newton, Jens Palsberg, David Peixotto, Vivek Sarkar, Frank Schlimbach, and Sağnak Taşırlar. 2010. Concurrent collections. Sci. Prog. 18, 3-4 (Aug. 2010), 203--217. DOI:DOI: https://doi.org/10.1155/2010/521797.Google ScholarCross Ref
- Sebastian Burckhardt, Alexandro Baldassin, and Daan Leijen. 2010. Concurrent programming with revisions and isolation types. In Proceedings of the ACM International Conference on Object -oriented Programming Systems Languages and Applications (OOPSLA’10). 691--707. DOI:DOI: https://doi.org/10.1145/1869459.1869515.Google ScholarDigital Library
- Sebastian Burckhardt and Daan Leijen. 2011. Semantics of concurrent revisions. In Proceedings of the European Symposium on Programming (ESOP’11). 116--135.Google ScholarCross Ref
- Sylvan Clebsch, Sophia Drossopoulou, Sebastian Blessing, and Andy McNeil. 2015. Deny capabilities for safe, fast actors. In Proceedings of the 5th International Workshop on Programming Based on Actors, Agents, and Decentralized Control (AGERE’15). 1--12. DOI:DOI: https://doi.org/10.1145/2824815.2824816.Google ScholarDigital Library
- Joeri De Koster. 2015. Domains: Language Abstractions for Controlling Shared Mutable State in Actor Systems. Ph.D. Dissertation. Vrije Universiteit Brussel.Google Scholar
- J. De Koster, S. Marr, T. Van Cutsem, and T. D’Hondt. 2016. Domains: Sharing state in the communicating event-loop actor model. Comput. Lang., Syst. Struct. 45 (2016), 132--160. DOI:DOI: https://doi.org/10.1016/j.cl.2016.01.003.Google ScholarDigital Library
- Joeri De Koster, Tom Van Cutsem, and Wolfgang De Meuter. 2016. 43 years of actors: A taxonomy of actor models and their key properties. In Proceedings of the 6th International Workshop on Programming Based on Actors, Agents, and Decentralized Control (AGERE’16). 31--40. DOI:DOI: https://doi.org/10.1145/3001886.3001890.Google ScholarDigital Library
- Peter J. Denning and Jack B. Dennis. 2010. The resurgence of parallelism. Commun. ACM 53, 6 (June 2010), 30--32.Google ScholarDigital Library
- E. W. Dijkstra. 1965. Solution of a problem in concurrent programming control. Commun. ACM 8, 9 (Sept. 1965), 569. DOI:DOI: https://doi.org/10.1145/365559.365617.Google ScholarDigital Library
- Eitan Farchi, Yarden Nir, and Shmuel Ur. 2003. Concurrent bug patterns and how to test them. In Proceedings of the International Parallel and Distributed Processing Symposium (IPDPS’03). DOI:DOI: https://doi.org/10.1109/IPDPS.2003.1213511.Google ScholarCross Ref
- Matthias Felleisen, Robert Bruce Findler, and Matthew Flatt. 2009. Semantics Engineering with PLT Redex. The MIT Press.Google ScholarDigital Library
- Cormac Flanagan and Matthias Felleisen. 1995. The semantics of future and its use in program optimization. In Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’95). 209--220.Google ScholarDigital Library
- Andy Georges, Dries Buytaert, and Lieven Eeckhout. 2007. Statistically rigorous Java performance evaluation. In Proceedings of the 22nd ACM SIGPLAN Conference on Object-oriented Programming Systems and Applications (OOPSLA’07). 57--76.Google ScholarDigital Library
- Patrice Godefroid and Nachi Nagappan. 2008. Concurrency at Microsoft—An Exploratory Survey. Technical Report. Retrieved from: https://www.microsoft.com/en-us/research/publication/concurrency-at-microsoft-an-exploratory-survey/.Google Scholar
- Rachid Guerraoui and Michał Kapałka. 2008. On the correctness of transactional memory. In Proceedings of the 13th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP’08). 175--184. DOI:DOI: https://doi.org/10.1145/1345206.1345233.Google ScholarDigital Library
- Nicholas Haines, Darrell Kindred, J. Gregory Morrisett, Scott M. Nettles, and Jeannette M. Wing. 1994. Composing first-class transactions. ACM Trans. Prog. Lang. Syst. 16, 6 (Nov. 1994), 1719--1736. DOI:DOI: https://doi.org/10.1145/197320.197346.Google ScholarDigital Library
- Stuart Halloway. 2009. Programming Clojure (1st ed.). Pragmatic Bookshelf.Google Scholar
- Robert H Halstead. 1985. MULTILISP: A language for concurrent symbolic computation. ACM Trans. Prog. Lang. Syst. 7, 4 (Oct. 1985), 501--538. DOI:DOI: https://doi.org/10.1145/4472.4478.Google ScholarDigital Library
- Tim Harris and Keir Fraser. 2003. Language support for lightweight transactions. In Proceedings of the 18th ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications (OOPSLA’03). 388--402. DOI:DOI: https://doi.org/10.1145/949305.949340.Google ScholarDigital Library
- Tim Harris, James R. Larus, and Ravi Rajwar. 2010. Transactional Memory (2nd ed.). Morgan 8 Claypool.Google ScholarDigital Library
- Tim Harris, Simon Marlow, Simon Peyton-Jones, and Maurice Herlihy. 2005. Composable memory transactions. In Proceedings of the 10th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP’05). 48--60. DOI:DOI: https://doi.org/10.1145/1065944.1065952.Google ScholarDigital Library
- Maurice Herlihy and J. Eliot B. Moss. 1993. Transactional memory: Architectural support for lock-free data structures. In Proceedings of the 20th International Symposium on Computer Architecture (ISCA’93). 289--300.Google ScholarDigital Library
- Maurice Herlihy and Nir Shavit. 2011. The Art of Multiprocessor Programming. Morgan Kaufmann.Google Scholar
- Carl Hewitt, Peter Bishop, and Richard Steiger. 1973. A universal modular ACTOR formalism for artificial intelligence. In Proceedings of the 3rd International Joint Conference on Artificial Intelligence (IJCAI’73). 235--245. Retrieved from: http://dl.acm.org/citation.cfm?id=1624775.1624804.Google ScholarDigital Library
- C. A. R. Hoare. 1978. Communicating sequential processes. Commun. ACM 21, 8 (Aug. 1978), 666--677. DOI:DOI: https://doi.org/10.1145/359576.359585.Google ScholarDigital Library
- David Hovemeyer and William Pugh. 2004. Finding concurrency bugs in Java. In Proceedings of the PODC Workshop on Concurrency and Synchronization in Java Programs. Retrieved from: https://www.cs.jhu.edu/ daveho/pubs/csjp2004.pdf.Google Scholar
- Gérard Huet. 1980. Confluent reductions: Abstract properties and applications to term rewriting systems: Abstract properties and applications to term rewriting systems. J. ACM 27, 4 (Oct. 1980), 797--821. DOI: DOI:https://doi.org/10.1145/322217.322230.Google ScholarDigital Library
- Shams M. Imam and Vivek Sarkar. 2012. Integrating task parallelism with actors. In Proceedings of the ACM International Conference on Object-oriented Programming Systems Languages and Applications (OOPSLA’12). 753--772.Google Scholar
- Edward A. Lee. 2006. The problem with threads. Computer 39, 5 (May 2006), 33--42. DOI:DOI: https://doi.org/10.1109/MC.2006.180.Google ScholarDigital Library
- Jonathan K. Lee and Jens Palsberg. 2010. Featherweight X10: A core calculus for async-finish parallelism. In Proceedings of the 15th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP’10). 25--36. DOI:DOI: https://doi.org/10.1145/1693453.1693459.Google ScholarDigital Library
- M. Lesani and A. Lain. 2013. Semantics-preserving sharing actors. In Proceedings of the Workshop on Programming Based on Actors, Agents, and Decentralized Control (AGERE’13). 69--80.Google Scholar
- M. Lesani and J. Palsberg. 2011. Communicating memory transactions. In Proceedings of the 16th ACM Symposium on Principles and Practice of Parallel Programming (PPoPP’11). 157--168.Google Scholar
- Shan Lu, Soyeon Park, Eunsoo Seo, and Yuanyuan Zhou. 2008. Learning from mistakes—A comprehensive study on real world concurrency bug characteristics. In Proceedings of the 13th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS’08). 329--339. DOI:DOI: https://doi.org/10.1145/1346281.1346323.Google ScholarDigital Library
- V. Luchangco and V. J. Marathe. 2011. Transaction communicators: Enabling cooperation among concurrent transactions. In Proceedings of the 16th ACM Symposium on Principles and Practice of Parallel Programming (PPoPP’11). 169--178.Google Scholar
- Chi Cao Minh, JaeWoong Chung, C. Kozyrakis, and K. Olukotun. 2008. STAMP: Stanford transactional applications for multi-processing. In Proceedings of the IEEE International Symposium on Workload Characterization. 35--46. DOI:DOI: https://doi.org/10.1109/IISWC.2008.4636089.Google ScholarCross Ref
- B. Morandi, S. Nanz, and B. Meyer. 2014. Safe and efficient data sharing for message-passing concurrency. In Proceedings of the 16th International Conference on Coordination Models and Languages (COORDINATION’14). 99--114.Google Scholar
- J. Eliot B. Moss. 1981. Nested Transactions: An Approach to Reliable Distributed Computing. Ph.D. Dissertation. Massachusetts Institute of Technology.Google Scholar
- J. Eliot B. Moss and Antony L. Hosking. 2006. Nested transactional memory: Model and architecture sketches. Sci. Comput. Prog. 63, 2 (2006), 186--201.Google ScholarDigital Library
- Michael Nash and Wade Waldron. 2016. Applied Akka Patterns: A Hands-On Guide to Designing Distributed Applications (1st ed.). O’Reilly Media, Inc.Google Scholar
- Armand Navabi and Suresh Jagannathan. 2009. Exceptionally safe futures. In Proceedings of the 11th International Conference on Coordination Models and Languages (COORDINATION’09). 47--65.Google ScholarDigital Library
- Nir Shavit and Dan Touitou. 1997. Software transactional memory. Distrib. Comput. 10, 2 (Feb. 1997), 99--116. DOI:DOI: https://doi.org/10.1007/s004460050028.Google ScholarCross Ref
- Y. Smaragdakis, A. Kay, R. Behrends, and M. Young. 2007. Transactions with isolation and cooperation. In Proceedings of the 22nd ACM SIGPLAN Conference on Object-oriented Programming Systems and Applications (OOPSLA’07). 191--210.Google Scholar
- Janwillem Swalens, Joeri De Koster, and Wolfgang De Meuter. 2016. Transactional tasks: Parallelism in software transactions. In Proceedings of the 30th European Conference on Object-oriented Programming (ECOOP’16). 23:1--23:28. DOI:DOI: https://doi.org/10.4230/LIPIcs.ECOOP.2016.23.Google ScholarCross Ref
- Janwillem Swalens, Joeri De Koster, and Wolfgang De Meuter. 2017. Transactional actors: Communication in transactions. In Proceedings of the 4th ACM SIGPLAN International Workshop on Software Engineering for Parallel Systems (SEPS’17). 31--41. DOI:DOI: https://doi.org/10.1145/3141865.3141866.Google ScholarDigital Library
- Janwillem Swalens, Stefan Marr, Joeri De Koster, and Tom Van Cutsem. 2014. Towards composable concurrency abstractions. In Proceedings of the Workshop on Programming Language Approaches to Concurrency and communication-cEntric Software (PLACES’14). DOI:DOI: https://doi.org/10.4204/EPTCS.155.8.Google ScholarCross Ref
- Andrew S. Tanenbaum and Herbert Bos. 2014. Modern Operating Systems (4th ed.). Prentice Hall Press.Google ScholarDigital Library
- Samira Tasharofi, Peter Dinges, and Ralph E. Johnson. 2013. Why do Scala developers mix the actor model with other concurrency models? In Proceedings of the 27th European Conference on Object-oriented Programming (ECOOP’13). 302--326. DOI:DOI: https://doi.org/10.1007/978-3-642-39038-8_13.Google ScholarDigital Library
- Peter Van Roy and Seif Haridi. 2004. Concepts, Techniques, and Models of Computer Programming. The MIT Press.Google ScholarDigital Library
- Jan Vitek, Suresh Jagannathan, Adam Welc, and Antony L. Hosking. 2004. A semantic framework for designer transactions. In Proceedings of the 13th European Symposium on Programming (ESOP’04). 249--263.Google Scholar
- Haris Volos, Adam Welc, Ali-Reza Adl-Tabatabai, Tatiana Shpeisman, Xinmin Tian, and Ravi Narayanaswamy. 2009. NePalTM: Design and implementation of nested parallelism for transactional memory systems. In Proceedings of the 14th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP’09). 291--292. DOI:DOI: https://doi.org/10.1145/1504176.1504220.Google ScholarDigital Library
- Alessandro Warth, Yoshiki Ohshima, Ted Kaehler, and Alan Kay. 2011. Worlds: Controlling the scope of side effects. In Proceedings of the 25th European Conference on Object-oriented Programming (ECOOP’11). 179--203.Google ScholarCross Ref
- Adam Welc, Suresh Jagannathan, and Antony Hosking. 2005. Safe futures for Java. In Proceedings of the 20th ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications (OOPSLA’05). 439--453. DOI:DOI: https://doi.org/10.1145/1094811.1094845.Google ScholarDigital Library
- Akinori Yonezawa, Jean-Pierre Briot, and Etsuya Shibayama. 1986. Object-oriented concurrent programming in ABCL/1. In Proceedings of the Conference Proceedings on Object-oriented Programming Systems, Languages and Applications (OOPSLA’86). 258--268. DOI:DOI: https://doi.org/10.1145/28697.28722.Google ScholarDigital Library
- Jingna Zeng, Joao Barreto, Seif Haridi, Luís Rodrigues, and Paolo Romano. 2016. The future(s) of transactional memory. In Proceedings of the 45th International Conference on Parallel Processing (ICPP’16). 442--451. DOI:DOI: https://doi.org/10.1109/ICPP.2016.57.Google ScholarCross Ref
- Yang Zhang and Eric A. Hansen. 2006. Parallel breadth-first heuristic search on a shared-memory architecture. In Proceedings of the Workshop on Heuristic Search, Memory-based Heuristics and Their Applications (AAAI’06).Google Scholar
Index Terms
- Chocola: Composable Concurrency Language
Recommendations
Chocola: integrating futures, actors, and transactions
AGERE 2018: Proceedings of the 8th ACM SIGPLAN International Workshop on Programming Based on Actors, Agents, and Decentralized ControlDevelopers often combine different concurrency models in a single program, in each part of the program using the model that fits best. Many programming languages, such as Clojure, Scala, and Haskell, cater to this need by supporting different ...
Safe privatization in transactional memory
PPoPP '18Transactional memory (TM) facilitates the development of concurrent applications by letting the programmer designate certain code blocks as atomic. Programmers using a TM often would like to access the same data both inside and outside transactions, ...
Safe privatization in transactional memory
PPoPP '18: Proceedings of the 23rd ACM SIGPLAN Symposium on Principles and Practice of Parallel ProgrammingTransactional memory (TM) facilitates the development of concurrent applications by letting the programmer designate certain code blocks as atomic. Programmers using a TM often would like to access the same data both inside and outside transactions, ...
Comments