Abstract
The reactor model is a foundational programming model for distributed computing, whose focus is modularizing and composing computations and message protocols. Previous work on reactors dealt mainly with the programming model and its composability properties, but did not show how to schedule computations in reactor-based programs. In this paper, we propose a pluggable scheduling algorithm for the reactor model. The algorithm is customizable with user-defined scheduling policies. We define and prove safety and progress properties. We compare our implementation against the Akka actor framework, and show up to \(3\times \) performance improvements on standard actor benchmarks.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
In Erlang, actor references are called process IDs.
- 2.
It was shown that encoding multiple protocols in the actor model using a single actor is possible, but made easier with custom protocol description languages [37]. Conversely, protocol modularisation can also be achieved by encapsulating groups of actors, each of which handles one aspect of the protocol. A custom architecture description language was made to facilitate this type of encapsulation [5]. One goal of the reactor model is to allow modularisation in the core model, without relying on another language layer.
- 3.
Users can do this explicitly in the reactor programming model, in which case the undelivered events are dropped. It is unclear to us how to achieve this using automatic GC, since there always exists a reference from the onEvent callback to the event stream object.
- 4.
This is not always possible – there exist programs in which the number of events grows over time. For example, if every reactor upon receiving an event sends out two events in response, then the overall number of messages in the program grows exponentially over time. However, if there exist an execution schedule in which the number of messages in the program at any given point is bounded, then the scheduler should use that execution schedule.
- 5.
In fact, check in line 3 of Fig. 2 ensures this even if schedule calls execute from multiple threads.
References
Akka Documentation (2015). http://akka.io/docs/
Erlang/OTP documentation (2015). http://www.erlang.org/
Reactors, IO Website (2016). https://reactors.io
Agha, G.: Actors: A Model of Concurrent Computation in Distributed Systems. MIT Press, Cambridge (1986)
Astley, M., Agha, G.A.: Customization and composition of distributed objects: middleware abstractions for policy management. In: Proceedings of the 6th ACM SIGSOFT International Symposium on Foundations of Software Engineering, SIGSOFT 1998/FSE-6, pp. 1–9. ACM, New York (1998). http://doi.acm.org/10.1145/288195.288206
Blumofe, R.D., Leiserson, C.E.: Scheduling multithreaded computations by work stealing. J. ACM 46(5), 720–748 (1999). http://doi.acm.org/10.1145/324133.324234
Dragos, I., Odersky, M.: Compiling generics through user-directed type specialization. In: Proceedings of the 4th Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, ICOOOLPS 2009, pp. 42–47. ACM, New York (2009). http://doi.acm.org/10.1145/1565824.1565830
Fournet, C., Gonthier, G.: The Join Calculus: a Language for Distributed Mobile Programming, September 2000. https://www.microsoft.com/en-us/research/publication/join-calculus-language-distributed-mobile-programming/
Georges, A., Buytaert, D., Eeckhout, L.: Statistically rigorous java performance evaluation. SIGPLAN Not. 42(10), 57–76 (2007). http://doi.acm.org/10.1145/1297105.1297033
Guerraoui, R., Rodrigues, L.: Introduction to Reliable Distributed Programming. Springer, Heidelberg (2006). https://doi.org/10.1007/978-3-642-15260-3
Haller, P., Odersky, M.: Event-based programming without inversion of control. In: Lightfoot, D.E., Szyperski, C. (eds.) JMLC 2006. LNCS, vol. 4228, pp. 4–22. Springer, Heidelberg (2006). https://doi.org/10.1007/11860990_2
Haller, P., Prokopec, A., Miller, H., Klang, V., Kuhn, R., Jovanovic, V.: Scala Improvement Proposal: Futures and Promises (SIP-14) (2012). http://docs.scala-lang.org/sips/pending/futures-promises.html
Herlihy, M., Shavit, N.: The Art of Multiprocessor Programming. Morgan Kaufmann Publishers Inc., San Francisco (2008)
Hindman, B., et al.: Mesos: a platform for fine-grained resource sharing in the data center. In: Proceedings of the 8th USENIX Conference on Networked Systems Design and Implementation, NSDI 2011, pp. 295–308. USENIX Association, Berkeley (2011). http://dl.acm.org/citation.cfm?id=1972457.1972488
Imam, S.M., Sarkar, V.: Savina - an actor benchmark suite: enabling empirical evaluation of actor libraries. In: Proceedings of the 4th International Workshop on Programming Based on Actors Agents and Decentralized Control, AGERE! 2014, pp. 67–80. ACM, New York (2014). http://doi.acm.org/10.1145/2687357.2687368
Imam, S.M., Sarkar, V.: Selectors: actors with multiple guarded mailboxes. In: Proceedings of the 4th International Workshop on Programming Based on Actors Agents and Decentralized Control, AGERE! 2014, pp. 1–14. ACM, New York (2014). http://doi.acm.org/10.1145/2687357.2687360
Lea, D.: A Java fork/Join framework. In: Proceedings of the ACM 2000 Conference on Java Grande, JAVA 2000, pp. 36–43. ACM, New York (2000). http://doi.acm.org/10.1145/337449.337465
Lynch, N.A.: Distributed Algorithms. MK Publishers Inc., San Francisco (1996)
Milner, R., Parrow, J., Walker, D.: A calculus of mobile processes. I. Inf. Comput. 100(1), 1–40 (1992). https://doi.org/10.1016/0890-5401(92)90008-4
Odersky, M., al.: An Overview of the Scala Programming Language. Technical report IC/2004/64, EPFL Lausanne, Switzerland (2004)
Pinte, K., Lombide Carreton, A., Gonzalez Boix, E., De Meuter, W.: Ambient clouds: reactive asynchronous collections for mobile ad hoc network applications. In: Dowling, J., Taïani, F. (eds.) DAIS 2013. LNCS, vol. 7891, pp. 85–98. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-38541-4_7
Prokopec, A.: ScalaMeter Website (2014). http://scalameter.github.io
Prokopec, A.: Snapqueue: lock-free queue with constant time snapshots. In: Proceedings of the 6th ACM SIGPLAN Symposium on Scala, Scala 2015, Portland, OR, USA, 15–17 June 2015, pp. 1–12 (2015). http://doi.acm.org/10.1145/2774975.2774976
Prokopec, A.: Pluggable scheduling for the reactor programming model. In: Proceedings of the 6th International Workshop on Programming Based on Actors, Agents, and Decentralized Control, AGERE 2016, pp. 41–50. ACM, New York (2016). http://doi.acm.org/10.1145/3001886.3001891
Prokopec, A.: Accelerating by idling: how speculative delays improve performance of message-oriented systems. In: Rivera, F.F., Pena, T.F., Cabaleiro, J.C. (eds.) Euro-Par 2017. LNCS, vol. 10417, pp. 177–191. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-64203-1_13
Prokopec, A.: Encoding the building blocks of communication. In: accepted at Onward 2017, to appear (2017)
Prokopec, A., Bagwell, P., Rompf, T., Odersky, M.: A generic parallel collection framework. In: Jeannot, E., Namyst, R., Roman, J. (eds.) Euro-Par 2011. LNCS, vol. 6853, pp. 136–147. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-23397-5_14
Prokopec, A., Haller, P., Odersky, M.: Containers and aggregates, mutators and isolates for reactive programming. In: Fifth Annual Scala Workshop, SCALA 2014, pp. 51–61. ACM (2014). http://doi.acm.org/10.1145/2637647.2637656
Prokopec, A., Miller, H., Schlatter, T., Haller, P., Odersky, M.: FlowPools: a lock-free deterministic concurrent dataflow abstraction. In: Kasahara, H., Kimura, K. (eds.) LCPC 2012. LNCS, vol. 7760, pp. 158–173. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-37658-0_11
Prokopec, A., Odersky, M.: Near optimal work-stealing tree scheduler for highly irregular data-parallel workloads. In: Caşcaval, C., Montesinos, P. (eds.) LCPC 2013. LNCS, vol. 8664, pp. 55–86. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-09967-5_4
Prokopec, A., Odersky, M.: Isolates, channels, and event streams for composable distributed programming. In: 2015 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software (Onward!), Onward! 2015, pp. 171–182. ACM, New York (2015). http://doi.acm.org/10.1145/2814228.2814245
Prokopec, A., Odersky, M.: Conc-trees for functional and parallel programming. In: Shen, X., Mueller, F., Tuck, J. (eds.) LCPC 2015. LNCS, vol. 9519, pp. 254–268. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-29778-1_16
Scholliers, C., Tanter, E., De Meuter, W.: Parallel actor monitors: disentangling task-level parallelism from data partitioning in the actor model. Sci. Comput. Program. 80, 52–64 (2014). Feb
Shapiro, M., Preguiça, N., Baquero, C., Zawirski, M.: A Comprehensive Study of Convergent and Commutative Replicated Data Types. Research Report RR-7506, January 2011. https://hal.inria.fr/inria-00555588
Silberschatz, A., Galvin, P.B., Gagne, G.: Operating System Concepts, 8th edn. Wiley Publishing (2008)
Srinivasan, S., Mycroft, A.: Kilim: Isolation-typed actors for java. In: Vitek, J. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 104–128. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-70592-5_6
Sturman, D.C., Agha, G.A.: A protocol description language for customizing failure semantics. In: Proceedings of IEEE 13th Symposium on Reliable Distributed Systems, pp. 148–157, October 1994
Verma, A., Pedrosa, L., Korupolu, M.R., Oppenheimer, D., Tune, E., Wilkes, J.: Large-scale cluster management at Google with borg. In: Proceedings of the European Conference on Computer Systems (EuroSys), Bordeaux, France (2015)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2018 Springer Nature Switzerland AG
About this chapter
Cite this chapter
Prokopec, A. (2018). Pluggable Scheduling for the Reactor Programming Model. In: Ricci, A., Haller, P. (eds) Programming with Actors. Lecture Notes in Computer Science(), vol 10789. Springer, Cham. https://doi.org/10.1007/978-3-030-00302-9_5
Download citation
DOI: https://doi.org/10.1007/978-3-030-00302-9_5
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-00301-2
Online ISBN: 978-3-030-00302-9
eBook Packages: Computer ScienceComputer Science (R0)