With the advent of multi-core processors concurrent programming is becoming indispensable. Scala's primary concurrency construct is actors. Actors are basically concurrent processes that communicate by exchanging messages. Actors can also be seen as a form of active objects where invoking a method corresponds to sending a message. The Scala Actors library provides both asynchronous and synchronous message sends (the latter are implemented by exchanging several asynchronous messages). Moreover, actors may communicate using futures where requests are handled asynchronously, but return a representation (the future) that allows to await the reply. This tutorial is mainly designed as a walk-through of several complete example programs Our first example consists of two actors that exchange a bunch of messages and then terminate. The first actor sends "ping" messages to the second actor, which in turn sends "pong" messages back (for each received "ping" message one "pong" message).
Dynamic Networks Everything I described so far is common to CSP (Communicating Sequential Processes) and the Actor model. Here’s what makes actors more general: Connections between actors are dynamic. Unlike processes in CSP, actors may establish communication channels dynamically. They may pass messages containing references to actors (or mailboxes). They can then send messages to those actors. Here’s a Scala example: receive { case (name: String, actor: Actor) => actor ! lookup(name) } The original message is a tuple combining a string and an actor object. The receiver sends the result of lookup(name) to the actor it has just learned about. Thus a new communication channel between the receiver and the unknown actor can be established at runtime. (In Kilim the same is possible by passing mailboxes via messages.)
T. Cutsem, S. Mostinckx, and W. Meuter. Computer Languages, Systems & Structures, 35 (1):
80 - 98(2009)ESUG 2007 International Conference on Dynamic Languages (ESUG/ICDL 2007).
E. D'Osualdo, J. Kochems, and L. Ong. Proceedings of the 2nd Edition on Programming Systems, Languages and Applications Based on Actors, Agents, and Decentralized Control Abstractions, page 137--140. ACM, (2012)
J. De Koster, S. Marr, and T. D'Hondt. Proceedings of the 17th ACM SIGPLAN symposium on Principles and Practice of Parallel Programming, page 317--318. ACM, (February 2012)(Poster).
J. De Koster, S. Marr, T. D'Hondt, and T. Van Cutsem. Proceedings of AGERE! 2013, 3rd International Workshop on Programming based on Actors, Agents, and Decentralized Control, page 61--68. (Oct 27, 2013)
J. De Koster, T. Van Cutsem, and W. De Meuter. Proceedings of the 6th International Workshop on Programming Based on Actors, Agents, and Decentralized Control, page 31--40. ACM, (2016)
H. Delugach, and D. Rochowiak. Proceedings of the 16th International Conference on Conceptual Structures (ICCS 2008), volume 5113 of Lecture Notes in Computer Science, page 269-281. Springer, (2008)
S. Fowler, S. Lindley, and P. Wadler. 31st European Conference on Object-Oriented Programming (ECOOP 2017), volume 74 of Leibniz International Proceedings in Informatics (LIPIcs), page 11:1--11:28. Dagstuhl, Germany, Schloss Dagstuhl--Leibniz-Zentrum für Informatik, (2017)