Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article
Open access

Chocola: Composable Concurrency Language

Published: 27 January 2021 Publication History
  • Get Citation Alerts
  • 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.

    References

    [1]
    Gul A. Agha. 1985. Actors: A Model of Concurrent Computation in Distributed Systems. Ph.D. Dissertation. Massachusetts Institute of Technology.
    [2]
    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.
    [3]
    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. https://doi.org/10.1145/1345206.1345232.
    [4]
    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. https://doi.org/10.1145/1810479.1810528.
    [5]
    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. https://doi.org/10.1145/800228.806932.
    [6]
    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. https://doi.org/10.1145/1693453.1693466.
    [7]
    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).
    [8]
    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. https://doi.org/10.1145/62044.62046.
    [9]
    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. https://doi.org/10.1145/223784.223785.
    [10]
    Philip A. Bernstein and Nathan Goodman. 1981. Concurrency control in distributed database systems. Comput. Surv. 13, 2 (June 1981), 185--221. https://doi.org/10.1145/356842.356846.
    [11]
    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. https://doi.org/10.1145/209936.209958.
    [12]
    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).
    [13]
    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.
    [14]
    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. https://doi.org/10.1155/2010/521797.
    [15]
    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. https://doi.org/10.1145/1869459.1869515.
    [16]
    Sebastian Burckhardt and Daan Leijen. 2011. Semantics of concurrent revisions. In Proceedings of the European Symposium on Programming (ESOP’11). 116--135.
    [17]
    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. https://doi.org/10.1145/2824815.2824816.
    [18]
    Joeri De Koster. 2015. Domains: Language Abstractions for Controlling Shared Mutable State in Actor Systems. Ph.D. Dissertation. Vrije Universiteit Brussel.
    [19]
    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. https://doi.org/10.1016/j.cl.2016.01.003.
    [20]
    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. https://doi.org/10.1145/3001886.3001890.
    [21]
    Peter J. Denning and Jack B. Dennis. 2010. The resurgence of parallelism. Commun. ACM 53, 6 (June 2010), 30--32.
    [22]
    E. W. Dijkstra. 1965. Solution of a problem in concurrent programming control. Commun. ACM 8, 9 (Sept. 1965), 569. https://doi.org/10.1145/365559.365617.
    [23]
    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). https://doi.org/10.1109/IPDPS.2003.1213511.
    [24]
    Matthias Felleisen, Robert Bruce Findler, and Matthew Flatt. 2009. Semantics Engineering with PLT Redex. The MIT Press.
    [25]
    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.
    [26]
    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.
    [27]
    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/.
    [28]
    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. https://doi.org/10.1145/1345206.1345233.
    [29]
    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. https://doi.org/10.1145/197320.197346.
    [30]
    Stuart Halloway. 2009. Programming Clojure (1st ed.). Pragmatic Bookshelf.
    [31]
    Robert H Halstead. 1985. MULTILISP: A language for concurrent symbolic computation. ACM Trans. Prog. Lang. Syst. 7, 4 (Oct. 1985), 501--538. https://doi.org/10.1145/4472.4478.
    [32]
    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. https://doi.org/10.1145/949305.949340.
    [33]
    Tim Harris, James R. Larus, and Ravi Rajwar. 2010. Transactional Memory (2nd ed.). Morgan 8 Claypool.
    [34]
    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. https://doi.org/10.1145/1065944.1065952.
    [35]
    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.
    [36]
    Maurice Herlihy and Nir Shavit. 2011. The Art of Multiprocessor Programming. Morgan Kaufmann.
    [37]
    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.
    [38]
    C. A. R. Hoare. 1978. Communicating sequential processes. Commun. ACM 21, 8 (Aug. 1978), 666--677. https://doi.org/10.1145/359576.359585.
    [39]
    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.
    [40]
    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.
    [41]
    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.
    [42]
    Edward A. Lee. 2006. The problem with threads. Computer 39, 5 (May 2006), 33--42. https://doi.org/10.1109/MC.2006.180.
    [43]
    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. https://doi.org/10.1145/1693453.1693459.
    [44]
    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.
    [45]
    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.
    [46]
    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. https://doi.org/10.1145/1346281.1346323.
    [47]
    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.
    [48]
    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. https://doi.org/10.1109/IISWC.2008.4636089.
    [49]
    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.
    [50]
    J. Eliot B. Moss. 1981. Nested Transactions: An Approach to Reliable Distributed Computing. Ph.D. Dissertation. Massachusetts Institute of Technology.
    [51]
    J. Eliot B. Moss and Antony L. Hosking. 2006. Nested transactional memory: Model and architecture sketches. Sci. Comput. Prog. 63, 2 (2006), 186--201.
    [52]
    Michael Nash and Wade Waldron. 2016. Applied Akka Patterns: A Hands-On Guide to Designing Distributed Applications (1st ed.). O’Reilly Media, Inc.
    [53]
    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.
    [54]
    Nir Shavit and Dan Touitou. 1997. Software transactional memory. Distrib. Comput. 10, 2 (Feb. 1997), 99--116. https://doi.org/10.1007/s004460050028.
    [55]
    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.
    [56]
    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. https://doi.org/10.4230/LIPIcs.ECOOP.2016.23.
    [57]
    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. https://doi.org/10.1145/3141865.3141866.
    [58]
    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). https://doi.org/10.4204/EPTCS.155.8.
    [59]
    Andrew S. Tanenbaum and Herbert Bos. 2014. Modern Operating Systems (4th ed.). Prentice Hall Press.
    [60]
    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. https://doi.org/10.1007/978-3-642-39038-8_13.
    [61]
    Peter Van Roy and Seif Haridi. 2004. Concepts, Techniques, and Models of Computer Programming. The MIT Press.
    [62]
    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.
    [63]
    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. https://doi.org/10.1145/1504176.1504220.
    [64]
    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.
    [65]
    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. https://doi.org/10.1145/1094811.1094845.
    [66]
    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. https://doi.org/10.1145/28697.28722.
    [67]
    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. https://doi.org/10.1109/ICPP.2016.57.
    [68]
    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).

    Cited By

    View all
    • (2023)When Concurrency Matters: Behaviour-Oriented ConcurrencyProceedings of the ACM on Programming Languages10.1145/36228527:OOPSLA2(1531-1560)Online publication date: 16-Oct-2023

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Transactions on Programming Languages and Systems
    ACM Transactions on Programming Languages and Systems  Volume 42, Issue 4
    December 2020
    265 pages
    ISSN:0164-0925
    EISSN:1558-4593
    DOI:10.1145/3441648
    Issue’s Table of Contents
    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 the author(s) 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: 27 January 2021
    Accepted: 01 September 2020
    Revised: 01 July 2020
    Received: 01 January 2020
    Published in TOPLAS Volume 42, Issue 4

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. Futures
    2. actor model
    3. software transactional memory

    Qualifiers

    • Research-article
    • Research
    • Refereed

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)124
    • Downloads (Last 6 weeks)23
    Reflects downloads up to 11 Aug 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2023)When Concurrency Matters: Behaviour-Oriented ConcurrencyProceedings of the ACM on Programming Languages10.1145/36228527:OOPSLA2(1531-1560)Online publication date: 16-Oct-2023

    View Options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    HTML Format

    View this article in HTML Format.

    HTML Format

    Get Access

    Login options

    Full Access

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media