ABSTRACT
Expressive actor models combine aspects of functional programming into the pure actor model enriched with futures. Such functional features include first-class closures which can be passed between actors and chained on futures. Combined with mutable objects, this opens the door to race conditions. In some situations, closures may not be evaluated by the actor that created them yet may access fields or objects owned by that actor. In other situations, closures may be safely fired off to run as a separate task.
This paper discusses the problem of who can safely evaluate a closure to avoid race conditions, and presents the current solution to the problem adopted by the Encore language. The solution integrates with Encore's capability type system, which influences whether a closure is attached and must be evaluated by the creating actor, or whether it can be detached and evaluated independently of its creator.
Encore's current solution to this problem is not final or optimal. We conclude by discussing a number of open problems related to dealing with closures in the actor model.
- Gul Agha. 1986. Actors: a model of concurrent computation in distributed systems. MIT Press. Google ScholarDigital Library
- Joe Armstrong, Robert Virding, Claes Wikström, and Mike Williams. 1993. Concurrent programming in Erlang. Prentice Hall. Google ScholarDigital Library
- Henry G. Baker and Carl Hewitt. 1977. The incremental garbage collection of processes. SIGART Newsletter 64 (1977), 55–59. Google ScholarDigital Library
- Frank De Boer, Vlad Serbanescu, Reiner Hähnle, Ludovic Henrio, Justine Rochas, Crystal Chang Din, Einar Broch Johnsen, Marjan Sirjani, Ehsan Khamespanah, Kiko Fernandez-Reyes, and Albert Mingkun Yang. 2017. A Survey of Active Object Languages. ACM Comput. Surv. 50, 5, Article 76 (Oct. 2017), 39 pages. Google ScholarDigital Library
- Stephan Brandauer, Elias Castegren, Dave Clarke, Kiko FernandezReyes, 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 Formal Methods for Multicore Programming, SFM 2015, M Bernardo and E B Johnsen (Eds.). Lecture Notes in Computer Science, Vol. 9104. Springer, 1–56.Google Scholar
- Denis Caromel, Christian Delbe, Alexandre Di Costanzo, and Mario Leyton. 2006. ProActive: an integrated platform for programming and running applications on grids and P2P systems. Computational Methods in Science and Technology 12 (2006), issue 1. https://hal. archives-ouvertes.fr/hal-00125034Google Scholar
- Elias Castegren, Joel Wallin, and Tobias Wrigstad. 2018. Bestow and Atomic: Concurrent Programming Using Isolation, Delegation and Grouping. Journal of Logical and Algebraic Methods in Programming 100 (2018), 130–151.Google ScholarCross Ref
- Elias Castegren and Tobias Wrigstad. 2016. Reference Capabilities for Concurrency Control. In 30th European Conference on ObjectOriented Programming, ECOOP 2016, July 18-22, 2016, Rome, Italy (LIPIcs), Shriram Krishnamurthi and Benjamin S. Lerner (Eds.), Vol. 56. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 5:1–5:26.Google Scholar
- 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! 2015, Pittsburgh, PA, USA, October 26, 2015, Elisa Gonzalez Boix, Philipp Haller, Alessandro Ricci, and Carlos Varela (Eds.). ACM, 1–12. Google ScholarDigital Library
- Jessie Dedecker, Tom Van Cutsem, Stijn Mostinckx, Theo D’Hondt, and Wolfgang De Meuter. 2006. Ambient-Oriented Programming in AmbientTalk. In ECOOP 2006 - Object-Oriented Programming, 20th European Conference, Nantes, France, July 3-7, 2006, Proceedings (Lecture Notes in Computer Science), Dave Thomas (Ed.), Vol. 4067. Springer, 230–254. Google ScholarDigital Library
- Pony Developers. 2018. Pony – High-Performance Actor Programming. http://www.ponylang.org . (2018).Google Scholar
- Kiko Fernandez-Reyes, Dave Clarke, Elias Castegren, and Huu-Phuc Vo. 2018. Forward to a Promising Future. In Coordination Models and Languages - 20th IFIP WG 6.1 International Conference, COORDINATION 2018, Held as Part of the 13th International Federated Conference on Distributed Computing Techniques, DisCoTec 2018, Madrid, Spain, June 18-21, 2018. Proceedings (Lecture Notes in Computer Science), Giovanna Di Marzo Serugendo and Michele Loreti (Eds.), Vol. 10852. Springer, 162–180.Google Scholar
- Lightbend Inc. 2018. AKKA – Scala actor library. http://akka.io/ . (2018).Google Scholar
- Einar Broch Johnsen, Reiner Hähnle, Jan Schäfer, Rudolf Schlatte, and Martin Steffen. 2010. ABS: A Core Language for Abstract Behavioral Specification. In Formal Methods for Components and Objects -9th International Symposium, FMCO 2010, Graz, Austria, November 29 - December 1, 2010. Revised Papers (Lecture Notes in Computer Science), Bernhard K. Aichernig, Frank S. de Boer, and Marcello M. Bonsangue (Eds.), Vol. 6957. Springer, 142–164. Google ScholarDigital Library
- Einar Broch Johnsen, Olaf Owe, and Ingrid Chieh Yu. 2006. Creol: A type-safe object-oriented model for distributed concurrent systems. Theor. Comput. Sci. 365, 1-2 (2006), 23–66. Google ScholarDigital Library
- R. Greg Lavender and Douglas C. Schmidt. 1996. Pattern Languages of Program Design 2. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, Chapter Active Object: An Object Behavioral Pattern for Concurrent Programming, 483–499. http://dl.acm.org/citation. cfm?id=231958.232967 Google ScholarDigital Library
- Heather Miller, Philipp Haller, and Martin Odersky. 2014. Spores: A type-based foundation for closures in the age of concurrency and distribution. In European Conference on Object-Oriented Programming (Lecture Notes in Computer Science), Vol. 8586. Springer, 308–333. Google ScholarDigital Library
- Mark Samuel Miller. 2006. Robust Composition: Towards a Unified Approach to Access Control and Concurrency Control. Ph.D. Dissertation. Johns Hopkins University, Baltimore, Maryland, USA.Google Scholar
- Samira Tasharofi, Peter Dinges, and Ralph E Johnson. 2013. Why do scala developers mix the actor model with other concurrency models?. In European Conference on Object-Oriented Programming (Lecture Notes in Computer Science), Vol. 7920. Springer, 302–326. Google ScholarDigital Library
- Yannick Welsch, Jan Schäfer, and Arnd Poetzsch-Heffter. 2013. Location Types for Safe Programming with Near and Far References. In Aliasing in Object-Oriented Programming. Types, Analysis and Verification, Dave Clarke, James Noble, and Tobias Wrigstad (Eds.). Lecture Notes in Computer Science, Vol. 7850. Springer, 471–500. Google ScholarDigital Library
- Yasuhiko Yokote and Mario Tokoro. 1987. Concurrent Programming in ConcurrentSmalltalk. In Object-Oriented Concurrent Programming, Akinori Yonezawa and Mario Tokoro (Eds.). MIT Press, 129–158. Google ScholarDigital Library
- Akinori Yonezawa, Jean-Pierre Briot, and Etsuya Shibayama. 1986. Object-Oriented Concurrent Programming in ABCL/1. In Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA’86), Portland, Oregon, Proceedings., Norman K. Meyrowitz (Ed.). ACM, 258–268. Google ScholarDigital Library
Index Terms
- Attached and detached closures in actors
Recommendations
Spores: A Type-Based Foundation for Closures in the Age of Concurrency and Distribution
Proceedings of the 28th European Conference on ECOOP 2014 --- Object-Oriented Programming - Volume 8586Functional programming FP is regularly touted as the way forward for bringing parallel, concurrent, and distributed programming to the mainstream. The popularity of the rationale behind this viewpoint has even led to a number of object-oriented OO ...
ALBA: a parallel language based on actors
In this paper, ALBA, A parallel Language Based on Actors, is introduced. ALBA [15] is a new programming language designed to take advantage of highly parallel architectures that use message passing as the fundamental low-level interaction primitive. ...
Scala Actors: Unifying thread-based and event-based programming
There is an impedance mismatch between message-passing concurrency and virtual machines, such as the JVM. VMs usually map their threads to heavyweight OS processes. Without a lightweight process abstraction, users are often forced to write parts of ...
Comments