SlideShare a Scribd company logo
Actor-Based ProgrammingOOP 2011Prof. Dr. Michael StalMichael.Stal@siemens.com
Objectives of this PresentationEmphasize the Multicore Revolution and its impact on ProgrammingIntroduce the Actor ModelPresent Show Case using ScalaConclusions Page 2
Motivation: From Single Core to Hard CoreMulti-Core processor architectures and GPUs offer scaling-up opportunitiesBut how can we harness these new hardware architectures?Obviously, we need to adapt our applicationsFortunately, Multi-Threading respectively Concurrent Programming comes to our rescue Page 3
ConcurrencyConcurrency and PerformanceWhen talking about improving the performance of software concurrency and multi-threadingare often considered as a promising technique for achieving this goal.Multi-threading can improve the“real” performance of a system on multi-processor platforms without incurring the overhead of multi-processing.“perceivable” performance of multi-user systems (even on a single-processor platform)
Concurrency PracticeUnfortunately ...Developing multi-threaded systems that are faster than single-threaded systems is a surprisingly non-trivial tasksome multi-threaded systems “only”run slower than their single-threaded counterpartsmost multi-threaded systems do not run at all, due to deadlocks theyproduce
Architectural PerspectiveConcurrency is not merely a programmer‘s choiceInstead, it covers all abstraction layers:Architecture: every system needs its customized concurrency architectureDesign: we must address issues such as synchronization and coordinationImplementation: we need to use the right features for the right purposeThe more a Concurrency approach supports this, the better!Page 6
Every System needs its Concurrency ArchitectureImage processing systems such as rendering farms or modalities require Pipes & FiltersHome-automation systems work best with Concurrent ReactorsProcess control is supported by Half Sync/Half AsyncLogging servers could use self-organizing Leaders/FollowersMobile agents may use the Blackboard Architecture for Information ExchangePage 7
Let‘s start with Object Oriented Concurrent ProgrammingObjects provide services (via methods)... and data (members)Static members resemble global state – beware of Singletons!In general, objects represent reactive (i.e., passive) entities of controlThey interoperate by method invocations or state manipulationUser-managed threads leverage multiple coresbut handling of threads and shared resources is left to the developerShared StateThreadPage 8datadatamethodsmethodsThread
Challenges of (Object-Oriented) Distributed and Concurrent ProgrammingA lot of pitfalls such as deadlocks and race condidions due toBurden of thread managementAccess to shared stateManaging Lockswhich doesn‘t scale for large distributed systems with high numbers of objectsPage 9Shared StatedatadatamethodsmethodsDanger ZoneThreadThread
Alternative Solution: Actors Actors have been introduced in the early 1970s by Hewitt for AI and Distribution:the Actor model is a mathematical model of concurrent computationthat treats "actors" as the universal primitives of concurrent digital computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received. [Hewitt, 73]Page 10Available almost everywhere: Scala, Erlang, F#, Axum, Io, Clojure, Java, Akka, Smalltalk, Prolog, AAL (Asynchronous Agents Library in Visual Studio 2010)
Properties of ActorsAccording to Gul Agha, an actoris an autonomous, interacting component of a distributed systema concurrency primitive not sharing resources with other actorsIt comprises: an immutable identity (name, virtual address)a mutable local state methods to manipulate local statea thread of control (not necessarily an OS thread)Page 11ActorStatethreadmethodmethodActors
Fundamentals of the Actor ModelAn actor may: process messages send messageschange local statecreate new actorsPage 12ActorStatethreadmethodInterfacemethod<< create >>Actorsmessage
Differences between Objects and ActorsObjects encapsulate state and behaviorActors encapsulate state, behavior and executionPage 13StateStatethreadmethodmethodInterfaceInterfacemethodmethod
Asynchronous And Event-Driven ProcessingHALF SYNC / HALF ASYNC PATTERNActorStateActor Mailbox =  Unique Actor AddressthreadmethodmethodIn general,sending messages to other  actors happens in asynchronous, nonblocking mode – often Actor implementations add synchronous mode
Actors react to events (i.e., message arrival)Principles of MessagesMessages sent to an actorshould only contain values but no referencesotherwise, the immutability would be gone with the windcan be considered event notifications that trigger actions within receiving actorare sent in a sort of „fire‘n forget“ Wild West style Page 15
Request/ReplyRequest/Reply semantics by exchanging messagesActor must know identity of sender to replyCall-by-Value Method invocation semantics:Incoming message contains argumentsOutgoing message contains resultManual solution: use tokens to correlate messagesPage 16Actor 2Actor 1<<send>><<send>>ASYNCHRONOUS COMPLETION TOKEN
Actors may implement the Active Object PatternA client invokes a method on the proxy. The proxy returns a future to the client, and creates a method request which it passes to the scheduler. The scheduler inserts the method request into the activation list (not shown here). When the method request becomes runnable, the scheduler removes it from the activation list (not shown here) and executes it. The method request executes the method on the servant and writes results, if any, to the future. Clientsobtain the method’s results via the future.ClientProxySchedulerServantmethodFutureMethodRequestinsertdispatchcallmethodwritereadDetour: Active Object Pattern
FuturesIf the sender needs to coordinate with result, futures represent a powerful conceptA future is an object that asynchronously waits for (and receives) the reply message of another actormay occur explicitly or implicitlyshould involve configurable timeouts Page 18Akka Example:val future = actor !!! Message// sometimes later:future.await// sometimes later:val result = future.getNote: In Akka you could also use awaitOne() or awaitAll() to wake up until one or all futures contain the awaited results
Possible Strategies in Message HandlingActor implementations can open up the strategy for handling messages BYO (Bring-Your-Own):let developer configure how messages are arranged within message queue  FIFO, priority based, etc.let developer provide dispatching strategy for handling messages such as using thread pools, single threads, etc.let developers add communication protocols for remote actorsPage 19StrategyContextalgorithm()strategy()Strategydispatch()ConcreteStrategyAConcreteStrategyB
Remote ActorsActors do not need to be constrained to one machineInstead, they may be distributed across different machinesIn this case, we need middleware mechanisms such asNetwork-wide identitiesRepositories for actor registrationClient-managed versus server-managed actors (in terms of lifecycle)Proxies for transparently accessing remote actorsMessaging interop protocolsPage 20StateNode ANode BStatethreadthreadmethodInterfacemethodmethodInterfacemethod
Handling Fault-ToleranceErlang provides its own philosophy for fault-tolerance: let it crashAlso used by some Actor libraries such as AkkaDifferent models possible:One for One: If one actor crashes, only restart the crashed actorAll for One: If one actor crashes stop the others too and restart actorsOne for One more suitable if actors are independent: otherwise use All for One Can be applied hierarchically, i.e. one supervisor might be supervised by another supervisorPage 21SupervisorlinkSupervisorlink
Sharing Data betweenActorsAgents are not a good solution for applications that share dataThis holds especially when combining multiple actions In database management systems, transactions come to our rescueSame can be done in memory using STMSTM canbeadded to actors to allowsafesharing of commondataPage 22
STMIdea: Separate object from identityIf object is going to be modifiedby an actor, let reference (identity) refer to new objectObjects themselves remainunchanged (immutability!)If anotheractor has changed the object in the meantimeroll back changeotherwise commit changePage 23RefObjectval xObject‘
AkkaintroducesTransactorsforSimplicityPage 24importakka.transactor.Transactorimportakka.stm.RefcaseobjectIncrementclassFriendlyCounter(friend: ActorRef) extendsTransactor{valcount = Ref(0)overridedefcoordinate = { caseIncrement => include(friend) // youcould also addseveralactorshere  }                                   // coordinate will send theIncrementmsg                                      // to otheractors - overriddenbySendTodefatomically = {  // entertransactioncaseIncrement => count alter (_ + 1)  }}
Example - Actors in Scala: Actor DefinitionActors in Scala defined as library, but with an „internal DSL“ look & feelActors must extend base class and define act() methodPage 25import scala.actors._class Starship (val id : String) extends Actor {	def act() {	  println("Engines of USS " + id + " starting")	  for (i <- 1 to 9) println("Warp " + i)	  println("Test succeeded")  	}}object ActorDemo1 extends Application {	new Starship("Enterprise") start}
Example - Actors in Scala: Simplified DefinitionUsing the actor method of the Actor companion object makes it even easier to define an actor:Page 26import scala.actors._import scala.actors.Actor._object ActorDemo2 extends Application {        val enterprise = actor {	  println("Engines of USS Enterprise starting")	  for (i <- 1 to 9) println("Warp " + i)	  println("Test succeeded")}}
Example - Actors in Scala: Processing MessagesMessages are sent to an actor with the bang operator !Messages are received within a receive block using pattern matchingPage 27case object STOPcase object ACCELERATEobject ActorDemo3 extends Application {val enterprise = actor { var continue = true; var speed = 0while(continue) {      receive {case msg  : String => println("Received: " + msg)	case STOP => println("stopping"); continue = false	case ACCELERATE => speed += 1; println("New speed Warp " + speed)      }     }  }  enterprise ! "Hello, Spock"  for (i <- 1 to 9) enterprise ! ACCELERATE  enterprise ! STOP}[info] Running ActorDemo3Received: Hello, SpockNew speed is Warp 1New speed is Warp 2New speed is Warp 3New speed is Warp 4New speed is Warp 5New speed is Warp 6New speed is Warp 7New speed is Warp 8New speed is Warp 9stopping[info] == run ==[success] Successful.
Example - Actors in Scala: react instead of receivereceive uses one thread and can return results reactmore efficient; does not return so that we need to use loop{while}Page 28[info] Running ActorDemo4Received: Hello, SpockNew speed is Warp 1New speed is Warp 2New speed is Warp 3New speed is Warp 4New speed is Warp 5New speed is Warp 6New speed is Warp 7New speed is Warp 8New speed is Warp 9stopping[info] == run ==[success] Successful.case object STOPcase object ACCELERATEclass Starship (val id : String) extends Actor {  private[this] var speed = 0  def act() {    var continue = true    loopWhile(true == continue) {react {        case msg  : String => println("Received: " + msg)        case STOP => println("stopping"); continue = false        case ACCELERATE => speed += 1; println("New speed is Warp " + speed)      }    }  }}object ActorDemo4 extends Application {  val enterprise = new Starship("Enterprise"); enterprise.start  enterprise ! "Hello, Kirk“ for (i <- 1 to 9) enterprise ! ACCELERATE; enterprise ! STOP}
Example - Actors in Scala: react with replyIn this example the actor returns a result using replyThe sender receives the result synchronously using !?Page 29case class AddItem (price: Double)case object SumUpcase object CartDeleteobject Cart extends Actor {  def act() {    var total = 0.0    loop {      react {        case AddItem(price) => total += price        case CartDelete => total = 0.0case SumUp => reply(total); exit      }    }  }}object CartDemo extends Application {  Cart.start  Cart ! AddItem(19.99); Cart ! AddItem(19.99); Cart ! AddItem(2.02)println("Please pay" + (Cart !? SumUp)) }[info] == run ==[info] Running CartDemoPlease pay 42.0[info] == run ==[success] Successful.
Example - Actors in Scala: react and receive with TIMEOUTIf we use react and receive we might block infinitely without receiving a message (especially after not sending any messages anymore)Using the versions with with a predefined waiting time is more efficient in these circumstancesOn timeout a message TIMEOUT is sent to the actorPage 30    loopWhile(true == continue) {reactWithin(1000) {	case msg  : String => println("Received: " + msg)case STOP => println("stopping"); continue = false	case ACCELERATE => speed += 1; println("New speed is Warp " + speed)      }    }
Example - Actors in Scala: Actors should not block using the ActiveActor patternIf actors block during processing a message, mutual deadlock conditions might occur. We can prevent this by separating message receipt and processingPage 31object ActorDemo6 extends Application {  val service = actor {def doWork() { // here the actual work is done       val service = self           actor {         Thread.sleep(100)         service ! "Serve"       }     }     var served = 0     doWork()loop { // here messages are processed       react {         case "Serve" => println("I am serving"); served += 1                         if (served < 3) doWork ()         case msg => println(msg)       }     }  }  service ! “Serve"}
Example - Actors in Scala: Using SchedulersDevelopers may override the scheduler method from the Actor traitFor example, SingleThreadedScheduler maps the actor always to the same (main) threadPer default the ForkJoinScheduler is appliedPage 32class Starship (val id : String) extends Actor {override def scheduler = scala.actors.scheduler.SingleThreadedScheduler  private[this] var speed = 0  def act() {    var continue = true    loopWhile(true == continue) {      react {        case msg  : String => println("Received: " + msg)        case STOP => println("stopping"); continue = false        case ACCELERATE => speed += 1; println("New speed is Warp " + speed)      }    }  }}
Example - Actors in Scala: Using DaemonsDaemon actors provides the same interface such as actors, butThe application may exit even if daemon actors are still runningOn the other hand, an application will wait for running actors to terminateIn addition we might use lightweight reactors (do not transmit the sender with each message, may only use react) or ReplyReactors (senders are passed)Page 33class Starship (val id : String) extends DaemonActor {  private[this] var speed = 0  def act() {    var continue = true    loopWhile(true == continue) {      react {        case msg  : String => println("Received: " + msg)        case STOP => println("stopping"); continue = false        case ACCELERATE => speed += 1; println("New speed is Warp " + speed)      }    }  }}
Example - Actors in Scala: Back to the FutureWith Futures we can receive a reply from an actor asynchronouslyWe need to use the !! operator which returns an objectUsing isSet on this object tells whether result is already availablePage 34case object STOPclass Echo extends Actor {  def act() {    var continue = true    while(continue) {      receive {        case msg  : String => Thread.sleep(1000); sender ! msg        case STOP => println("stopping"); continue = false      }    }  }}object Future extends Application { val echo = new Echo;   echo.startval replyMsg = echo !! "Hello OOP"  println(replyMsg)  println(replyMsg()) // get the result  echo ! STOP}[info] == run ==[info] Running Future<function0>Hello OOPstopping[info] == run ==[success] Successful..
Example - Actors in Scala: Remote Actors ServerRemote Actors can interact across machine or process boundariesThe server needs to register itselfPage 35import scala.actors.Actor._import scala.actors.remote.RemoteActor._object Server {  def remoteShip(ship : String, name: Symbol) = actor {      alive(8888)      register(name, self)      var continue = true; var speed = 0      loopWhile(continue) {        react {case"Stop" => println("Scotty is stopping"); continue = false	case msg : String => println("Uhura received: " + msg)case i : Int => speed += i; println("Spock reports warp speed " + speed)        }       }      }	   def main(args : Array[String]) {     remoteShip("Enterprise", 'enterprise)   }}
Example - Actors in Scala: Remote Actors Client The client connects to the remote node, ...... selects an actor on this node,and sends messages to the remote actorPage 36import scala.actors.Actor._import scala.actors.remote._import scala.actors.remote.RemoteActor._object Client extends Application {val node = Node("127.0.0.1", 8888)   actor {val ship = select(node, 'enterprise)     ship ! "Hello"     for (i <- 1 to 9) ship ! i     ship ! "Stop"    }	}[info] Running ServerUhura received: HelloSpock reports warp speed 4Spock reports warp speed 5Spock reports warp speed 1Spock reports warp speed 6Spock reports warp speed 2Spock reports warp speed 7Spock reports warp speed 3Spock reports warp speed 8Spock reports warp speed 9Scotty is stopping[info] == run ==[success] Successfull.
Example - Actors in Scala: Concurrency Example (1)Example taken from Programming Scala by Venkat SubramaniamTask: find if number is perfect It is perfect  its factors sum up to be twice the numberInstead of using a single-threaded algorithm to check we are using multiple actorsThe number is partitioned into n ranges each of which an actor analyzesKind of Map-Reduce / Master-Slave approach Page 37..........1    to   10002001 to 30001001 to 2000
Example - Actors in Scala: Concurrency Example (2)Page 38def sumOfFactors(number: Int) = {  (0 /: (1 to number)) { (sum, i) => if (number % i == 0) sum + i else sum }}def isPerfect(candidate: Int) = { 2 * candidate == sumOfFactors(candidate) }def sumOfFactorsInRange(lower: Int, upper: Int, number: Int) = {  (0 /: (lower to upper)) { (sum, i) => if (number % i == 0) sum + i else sum }}def isPerfectConcurrent(candidate: Int) = {  val RANGE = 1000000  val numberOfPartitions = (candidate.toDouble / RANGE).ceil.toInt  val caller = self  for (i <- 0 until numberOfPartitions) {     val lower = i * RANGE + 1;    val upper = candidate min (i + 1) * RANGE    actor {       caller ! sumOfFactorsInRange(lower, upper, candidate)     }}  val sum = (0 /: (0 until numberOfPartitions)) { (partialSum, i) =>    receive {       case sumInRange : Int => partialSum + sumInRange    }}            2 * candidate == sum}
Actors to the Limits - Akka for ScalaAkka provides a much more extensive Actor library developed by Jonas BonérOffers typed and untyped actorsSupports STM and TransactorsAllows searching for actors in its registryProvides Oz-like Dataflow concurrencyAnd moreErlang-like Fault ToleranceSerialization of actors and their referencesAdd-on modules for OSGi, Camel, JTA, ...Page 39
Example - Actors in F#The functional programming language F# (standard language in Visual Studio 2010) also supports Actor-based programmingPage 40open Systemlet mailbox =   MailboxProcessor.Start(fun mb ->    let rec loop x =      async { let! msg = mb.Receive()              printfn "I received: %s"  msg              return! loop x }    loop 0)mailbox.Post("Hallo")mailbox.Post(“OOP“)Console.ReadLine() |> ignore
Example - Actors in ErlangErlang - the first commercially relevant language that introduced actors (language feature)Scala inherited this approachPage 41module_as_actor(E) when is_record(E, event) ->    case lists:keysearch(mfa, 1, E#event.contents) of        {value, {mfa, {M, F, _A}}} ->            case lists:keysearch(pam_result, 1, E#event.contents) of                {value, {pam_result, {M2, _F2, _A2}}} ->                    {true, E#event{label = F, from = M2, to = M}};                _ ->                    {true, E#event{label = F, from = M, to = M}}            end;        _ ->            false    end.
Alternative Approach: Using a DSL such as Microsoft AxumPage 42Available for .NETIncubator projectActor definition in Axum, Code also in other .NET languagesDomainDomainShared StateShared Statechannel ChAddition{     input int Add;     output int Sum;     Start: { Add -> S1; }     S1: { Sum -> End; }}Reader AgentWriterAgentAgent:ReaderWriterAgentChannel w/ protocolAgent:Readerdomain A{intaccu;  int sum(int op) { }     agent Z : ChAddition{ }}Reader AgentsWriterAgentWriterAgentWriterAgentSchemaSchemaMicrosoft C++ developers should look at the AAL (Asynchronous Agents Library)
Different Actor Frameworks for Java availableAkkaActorFoundryActor‘s Guild JetlangKilimPage 43Example from Akka Web site http://akkasource.org/// server codeclass HelloWorldActor extends UntypedActor {  public void onReceive(Object msg) {    getContext().reply(msg + " World");  }}RemoteNode.start("localhost", 9999).register(  "hello-service",    actorOf(HelloWorldActor.class);// client codeActorRef actor = RemoteClient.actorFor(  "hello-service", "localhost", 9999);Object res = actor.sendRequestReply("Hello");
Some Possible Liabilities of Actors*In the pure actor model there is no notion of behavior inheritanceDynamic creation of new actors leads to expansion of statenecessity to decide about where to run and store a new actormaybe new communication channelsNote: in a purely actor-based model entities such as integers would be actorsDifficulty to replace behavior in an actorWhat about stream-based media?Fortunately, most of these liabilities can be avoided in hybrid OO/Actor modelsPage 44*see http://www.doc.ic.ac.uk/~nd/surprise_97/journal/vol2/pjm2/
SummaryMulti-core revolution is pushing developers hard; using self-managed threads and synchronization leads to accidental complexityThe Actor model seems to be a promising alternative for Concurrent ProgrammingNew languages and frameworks mix functional, object-oriented concepts with actorsActors are not the right solution for all problems, e.g., for really stateful tasksIntroduction of actors should follow design of software architecture, especially its concurrency and distribution architecture. Still valid: A fool with a tool is still a foolPage 45

More Related Content

What's hot (19)

PPSX
Esoft Metro Campus - Certificate in c / c++ programming
Rasan Samarasinghe
 
PPTX
C++ Object Oriented Programming
Gamindu Udayanga
 
PPTX
Generic Programming in java
Garik Kalashyan
 
PPT
Javascript
guest03a6e6
 
PPT
Object-Oriented Programming Using C++
Salahaddin University-Erbil
 
PDF
Object Oriented Programming using C++ Part III
Ajit Nayak
 
PDF
Java Persistence API
Ilio Catallo
 
PPTX
pebble - Building apps on pebble
Aniruddha Chakrabarti
 
PPTX
A (too) Short Introduction to Scala
Riccardo Cardin
 
PPTX
Oops presentation
sushamaGavarskar1
 
PDF
Why Java Sucks and C# Rocks (Final)
jeffz
 
PPT
ParaSail
AdaCore
 
PPTX
Java - Generic programming
Riccardo Cardin
 
PDF
A COMPLETE FILE FOR C++
M Hussnain Ali
 
PPSX
DIWE - Fundamentals of PHP
Rasan Samarasinghe
 
PPT
C++ oop
Sunil OS
 
PPTX
Modern C++
Richard Thomson
 
PPT
Java tutorial for Beginners and Entry Level
Ramrao Desai
 
PDF
Introduction to C++
Pranali Chaudhari
 
Esoft Metro Campus - Certificate in c / c++ programming
Rasan Samarasinghe
 
C++ Object Oriented Programming
Gamindu Udayanga
 
Generic Programming in java
Garik Kalashyan
 
Javascript
guest03a6e6
 
Object-Oriented Programming Using C++
Salahaddin University-Erbil
 
Object Oriented Programming using C++ Part III
Ajit Nayak
 
Java Persistence API
Ilio Catallo
 
pebble - Building apps on pebble
Aniruddha Chakrabarti
 
A (too) Short Introduction to Scala
Riccardo Cardin
 
Oops presentation
sushamaGavarskar1
 
Why Java Sucks and C# Rocks (Final)
jeffz
 
ParaSail
AdaCore
 
Java - Generic programming
Riccardo Cardin
 
A COMPLETE FILE FOR C++
M Hussnain Ali
 
DIWE - Fundamentals of PHP
Rasan Samarasinghe
 
C++ oop
Sunil OS
 
Modern C++
Richard Thomson
 
Java tutorial for Beginners and Entry Level
Ramrao Desai
 
Introduction to C++
Pranali Chaudhari
 

Similar to Oop2011 actor presentation_stal (20)

PDF
Introduction to concurrent programming with akka actors
datamantra
 
PDF
Introduction to concurrent programming with Akka actors
Shashank L
 
PDF
Akka lsug skills matter
Skills Matter
 
PDF
Scaling Web Apps with Akka
Maciej Matyjas
 
KEY
Akka london scala_user_group
Skills Matter
 
PDF
Introducing Akka
Meetu Maltiar
 
PDF
Building Massively Scalable application with Akka 2.0
Knoldus Inc.
 
PDF
Actor, an elegant model for concurrent and distributed computation
Alessio Coltellacci
 
PDF
Introduction to Actor Model and Akka
Yung-Lin Ho
 
PDF
Actor Model Akka Framework
Harinath Krishnamoorthy
 
PDF
Model with actors and implement with Akka
Ngoc Dao
 
PPTX
Akka Actors
Dylan Forciea
 
PDF
Akka (1)
Rahul Shukla
 
PDF
Akka-intro-training-public.pdf
BernardDeffarges
 
KEY
Introduction to Actor Model and Akka
Yung-Lin Ho
 
PDF
Build Cloud Applications with Akka and Heroku
Salesforce Developers
 
PDF
A gentle introduction into AKKA and the actor model
Mykhailo Kotsur
 
PPTX
Reactive Programming using Actor Model in Akka
StephenKoc1
 
PPTX
Actor-based concurrency and Akka Fundamentals
Ngoc Dao
 
PDF
Take a Look at Akka+Java (English version)
GlobalLogic Ukraine
 
Introduction to concurrent programming with akka actors
datamantra
 
Introduction to concurrent programming with Akka actors
Shashank L
 
Akka lsug skills matter
Skills Matter
 
Scaling Web Apps with Akka
Maciej Matyjas
 
Akka london scala_user_group
Skills Matter
 
Introducing Akka
Meetu Maltiar
 
Building Massively Scalable application with Akka 2.0
Knoldus Inc.
 
Actor, an elegant model for concurrent and distributed computation
Alessio Coltellacci
 
Introduction to Actor Model and Akka
Yung-Lin Ho
 
Actor Model Akka Framework
Harinath Krishnamoorthy
 
Model with actors and implement with Akka
Ngoc Dao
 
Akka Actors
Dylan Forciea
 
Akka (1)
Rahul Shukla
 
Akka-intro-training-public.pdf
BernardDeffarges
 
Introduction to Actor Model and Akka
Yung-Lin Ho
 
Build Cloud Applications with Akka and Heroku
Salesforce Developers
 
A gentle introduction into AKKA and the actor model
Mykhailo Kotsur
 
Reactive Programming using Actor Model in Akka
StephenKoc1
 
Actor-based concurrency and Akka Fundamentals
Ngoc Dao
 
Take a Look at Akka+Java (English version)
GlobalLogic Ukraine
 
Ad

Recently uploaded (20)

PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PPTX
Views on Education of Indian Thinkers J.Krishnamurthy..pptx
ShrutiMahanta1
 
PDF
IMP NAAC REFORMS 2024 - 10 Attributes.pdf
BHARTIWADEKAR
 
PDF
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PPTX
Views on Education of Indian Thinkers Mahatma Gandhi.pptx
ShrutiMahanta1
 
PDF
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
PPTX
How to Manage Promotions in Odoo 18 Sales
Celine George
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PPTX
Capitol Doctoral Presentation -July 2025.pptx
CapitolTechU
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
How to Create Rental Orders in Odoo 18 Rental
Celine George
 
PDF
Federal dollars withheld by district, charter, grant recipient
Mebane Rash
 
PDF
1, 2, 3… E MAIS UM CICLO CHEGA AO FIM!.pdf
Colégio Santa Teresinha
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PDF
Zoology (Animal Physiology) practical Manual
raviralanaresh2
 
PPTX
Soil and agriculture microbiology .pptx
Keerthana Ramesh
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
Views on Education of Indian Thinkers J.Krishnamurthy..pptx
ShrutiMahanta1
 
IMP NAAC REFORMS 2024 - 10 Attributes.pdf
BHARTIWADEKAR
 
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
Dimensions of Societal Planning in Commonism
StefanMz
 
Views on Education of Indian Thinkers Mahatma Gandhi.pptx
ShrutiMahanta1
 
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
How to Manage Promotions in Odoo 18 Sales
Celine George
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
Capitol Doctoral Presentation -July 2025.pptx
CapitolTechU
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
How to Create Rental Orders in Odoo 18 Rental
Celine George
 
Federal dollars withheld by district, charter, grant recipient
Mebane Rash
 
1, 2, 3… E MAIS UM CICLO CHEGA AO FIM!.pdf
Colégio Santa Teresinha
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
Zoology (Animal Physiology) practical Manual
raviralanaresh2
 
Soil and agriculture microbiology .pptx
Keerthana Ramesh
 
Ad

Oop2011 actor presentation_stal

  • 2. Objectives of this PresentationEmphasize the Multicore Revolution and its impact on ProgrammingIntroduce the Actor ModelPresent Show Case using ScalaConclusions Page 2
  • 3. Motivation: From Single Core to Hard CoreMulti-Core processor architectures and GPUs offer scaling-up opportunitiesBut how can we harness these new hardware architectures?Obviously, we need to adapt our applicationsFortunately, Multi-Threading respectively Concurrent Programming comes to our rescue Page 3
  • 4. ConcurrencyConcurrency and PerformanceWhen talking about improving the performance of software concurrency and multi-threadingare often considered as a promising technique for achieving this goal.Multi-threading can improve the“real” performance of a system on multi-processor platforms without incurring the overhead of multi-processing.“perceivable” performance of multi-user systems (even on a single-processor platform)
  • 5. Concurrency PracticeUnfortunately ...Developing multi-threaded systems that are faster than single-threaded systems is a surprisingly non-trivial tasksome multi-threaded systems “only”run slower than their single-threaded counterpartsmost multi-threaded systems do not run at all, due to deadlocks theyproduce
  • 6. Architectural PerspectiveConcurrency is not merely a programmer‘s choiceInstead, it covers all abstraction layers:Architecture: every system needs its customized concurrency architectureDesign: we must address issues such as synchronization and coordinationImplementation: we need to use the right features for the right purposeThe more a Concurrency approach supports this, the better!Page 6
  • 7. Every System needs its Concurrency ArchitectureImage processing systems such as rendering farms or modalities require Pipes & FiltersHome-automation systems work best with Concurrent ReactorsProcess control is supported by Half Sync/Half AsyncLogging servers could use self-organizing Leaders/FollowersMobile agents may use the Blackboard Architecture for Information ExchangePage 7
  • 8. Let‘s start with Object Oriented Concurrent ProgrammingObjects provide services (via methods)... and data (members)Static members resemble global state – beware of Singletons!In general, objects represent reactive (i.e., passive) entities of controlThey interoperate by method invocations or state manipulationUser-managed threads leverage multiple coresbut handling of threads and shared resources is left to the developerShared StateThreadPage 8datadatamethodsmethodsThread
  • 9. Challenges of (Object-Oriented) Distributed and Concurrent ProgrammingA lot of pitfalls such as deadlocks and race condidions due toBurden of thread managementAccess to shared stateManaging Lockswhich doesn‘t scale for large distributed systems with high numbers of objectsPage 9Shared StatedatadatamethodsmethodsDanger ZoneThreadThread
  • 10. Alternative Solution: Actors Actors have been introduced in the early 1970s by Hewitt for AI and Distribution:the Actor model is a mathematical model of concurrent computationthat treats "actors" as the universal primitives of concurrent digital computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received. [Hewitt, 73]Page 10Available almost everywhere: Scala, Erlang, F#, Axum, Io, Clojure, Java, Akka, Smalltalk, Prolog, AAL (Asynchronous Agents Library in Visual Studio 2010)
  • 11. Properties of ActorsAccording to Gul Agha, an actoris an autonomous, interacting component of a distributed systema concurrency primitive not sharing resources with other actorsIt comprises: an immutable identity (name, virtual address)a mutable local state methods to manipulate local statea thread of control (not necessarily an OS thread)Page 11ActorStatethreadmethodmethodActors
  • 12. Fundamentals of the Actor ModelAn actor may: process messages send messageschange local statecreate new actorsPage 12ActorStatethreadmethodInterfacemethod<< create >>Actorsmessage
  • 13. Differences between Objects and ActorsObjects encapsulate state and behaviorActors encapsulate state, behavior and executionPage 13StateStatethreadmethodmethodInterfaceInterfacemethodmethod
  • 14. Asynchronous And Event-Driven ProcessingHALF SYNC / HALF ASYNC PATTERNActorStateActor Mailbox = Unique Actor AddressthreadmethodmethodIn general,sending messages to other actors happens in asynchronous, nonblocking mode – often Actor implementations add synchronous mode
  • 15. Actors react to events (i.e., message arrival)Principles of MessagesMessages sent to an actorshould only contain values but no referencesotherwise, the immutability would be gone with the windcan be considered event notifications that trigger actions within receiving actorare sent in a sort of „fire‘n forget“ Wild West style Page 15
  • 16. Request/ReplyRequest/Reply semantics by exchanging messagesActor must know identity of sender to replyCall-by-Value Method invocation semantics:Incoming message contains argumentsOutgoing message contains resultManual solution: use tokens to correlate messagesPage 16Actor 2Actor 1<<send>><<send>>ASYNCHRONOUS COMPLETION TOKEN
  • 17. Actors may implement the Active Object PatternA client invokes a method on the proxy. The proxy returns a future to the client, and creates a method request which it passes to the scheduler. The scheduler inserts the method request into the activation list (not shown here). When the method request becomes runnable, the scheduler removes it from the activation list (not shown here) and executes it. The method request executes the method on the servant and writes results, if any, to the future. Clientsobtain the method’s results via the future.ClientProxySchedulerServantmethodFutureMethodRequestinsertdispatchcallmethodwritereadDetour: Active Object Pattern
  • 18. FuturesIf the sender needs to coordinate with result, futures represent a powerful conceptA future is an object that asynchronously waits for (and receives) the reply message of another actormay occur explicitly or implicitlyshould involve configurable timeouts Page 18Akka Example:val future = actor !!! Message// sometimes later:future.await// sometimes later:val result = future.getNote: In Akka you could also use awaitOne() or awaitAll() to wake up until one or all futures contain the awaited results
  • 19. Possible Strategies in Message HandlingActor implementations can open up the strategy for handling messages BYO (Bring-Your-Own):let developer configure how messages are arranged within message queue FIFO, priority based, etc.let developer provide dispatching strategy for handling messages such as using thread pools, single threads, etc.let developers add communication protocols for remote actorsPage 19StrategyContextalgorithm()strategy()Strategydispatch()ConcreteStrategyAConcreteStrategyB
  • 20. Remote ActorsActors do not need to be constrained to one machineInstead, they may be distributed across different machinesIn this case, we need middleware mechanisms such asNetwork-wide identitiesRepositories for actor registrationClient-managed versus server-managed actors (in terms of lifecycle)Proxies for transparently accessing remote actorsMessaging interop protocolsPage 20StateNode ANode BStatethreadthreadmethodInterfacemethodmethodInterfacemethod
  • 21. Handling Fault-ToleranceErlang provides its own philosophy for fault-tolerance: let it crashAlso used by some Actor libraries such as AkkaDifferent models possible:One for One: If one actor crashes, only restart the crashed actorAll for One: If one actor crashes stop the others too and restart actorsOne for One more suitable if actors are independent: otherwise use All for One Can be applied hierarchically, i.e. one supervisor might be supervised by another supervisorPage 21SupervisorlinkSupervisorlink
  • 22. Sharing Data betweenActorsAgents are not a good solution for applications that share dataThis holds especially when combining multiple actions In database management systems, transactions come to our rescueSame can be done in memory using STMSTM canbeadded to actors to allowsafesharing of commondataPage 22
  • 23. STMIdea: Separate object from identityIf object is going to be modifiedby an actor, let reference (identity) refer to new objectObjects themselves remainunchanged (immutability!)If anotheractor has changed the object in the meantimeroll back changeotherwise commit changePage 23RefObjectval xObject‘
  • 24. AkkaintroducesTransactorsforSimplicityPage 24importakka.transactor.Transactorimportakka.stm.RefcaseobjectIncrementclassFriendlyCounter(friend: ActorRef) extendsTransactor{valcount = Ref(0)overridedefcoordinate = { caseIncrement => include(friend) // youcould also addseveralactorshere } // coordinate will send theIncrementmsg // to otheractors - overriddenbySendTodefatomically = { // entertransactioncaseIncrement => count alter (_ + 1) }}
  • 25. Example - Actors in Scala: Actor DefinitionActors in Scala defined as library, but with an „internal DSL“ look & feelActors must extend base class and define act() methodPage 25import scala.actors._class Starship (val id : String) extends Actor { def act() { println("Engines of USS " + id + " starting") for (i <- 1 to 9) println("Warp " + i) println("Test succeeded") }}object ActorDemo1 extends Application { new Starship("Enterprise") start}
  • 26. Example - Actors in Scala: Simplified DefinitionUsing the actor method of the Actor companion object makes it even easier to define an actor:Page 26import scala.actors._import scala.actors.Actor._object ActorDemo2 extends Application { val enterprise = actor { println("Engines of USS Enterprise starting") for (i <- 1 to 9) println("Warp " + i) println("Test succeeded")}}
  • 27. Example - Actors in Scala: Processing MessagesMessages are sent to an actor with the bang operator !Messages are received within a receive block using pattern matchingPage 27case object STOPcase object ACCELERATEobject ActorDemo3 extends Application {val enterprise = actor { var continue = true; var speed = 0while(continue) { receive {case msg : String => println("Received: " + msg) case STOP => println("stopping"); continue = false case ACCELERATE => speed += 1; println("New speed Warp " + speed) } } } enterprise ! "Hello, Spock" for (i <- 1 to 9) enterprise ! ACCELERATE enterprise ! STOP}[info] Running ActorDemo3Received: Hello, SpockNew speed is Warp 1New speed is Warp 2New speed is Warp 3New speed is Warp 4New speed is Warp 5New speed is Warp 6New speed is Warp 7New speed is Warp 8New speed is Warp 9stopping[info] == run ==[success] Successful.
  • 28. Example - Actors in Scala: react instead of receivereceive uses one thread and can return results reactmore efficient; does not return so that we need to use loop{while}Page 28[info] Running ActorDemo4Received: Hello, SpockNew speed is Warp 1New speed is Warp 2New speed is Warp 3New speed is Warp 4New speed is Warp 5New speed is Warp 6New speed is Warp 7New speed is Warp 8New speed is Warp 9stopping[info] == run ==[success] Successful.case object STOPcase object ACCELERATEclass Starship (val id : String) extends Actor { private[this] var speed = 0 def act() { var continue = true loopWhile(true == continue) {react { case msg : String => println("Received: " + msg) case STOP => println("stopping"); continue = false case ACCELERATE => speed += 1; println("New speed is Warp " + speed) } } }}object ActorDemo4 extends Application { val enterprise = new Starship("Enterprise"); enterprise.start enterprise ! "Hello, Kirk“ for (i <- 1 to 9) enterprise ! ACCELERATE; enterprise ! STOP}
  • 29. Example - Actors in Scala: react with replyIn this example the actor returns a result using replyThe sender receives the result synchronously using !?Page 29case class AddItem (price: Double)case object SumUpcase object CartDeleteobject Cart extends Actor { def act() { var total = 0.0 loop { react { case AddItem(price) => total += price case CartDelete => total = 0.0case SumUp => reply(total); exit } } }}object CartDemo extends Application { Cart.start Cart ! AddItem(19.99); Cart ! AddItem(19.99); Cart ! AddItem(2.02)println("Please pay" + (Cart !? SumUp)) }[info] == run ==[info] Running CartDemoPlease pay 42.0[info] == run ==[success] Successful.
  • 30. Example - Actors in Scala: react and receive with TIMEOUTIf we use react and receive we might block infinitely without receiving a message (especially after not sending any messages anymore)Using the versions with with a predefined waiting time is more efficient in these circumstancesOn timeout a message TIMEOUT is sent to the actorPage 30 loopWhile(true == continue) {reactWithin(1000) { case msg : String => println("Received: " + msg)case STOP => println("stopping"); continue = false case ACCELERATE => speed += 1; println("New speed is Warp " + speed) } }
  • 31. Example - Actors in Scala: Actors should not block using the ActiveActor patternIf actors block during processing a message, mutual deadlock conditions might occur. We can prevent this by separating message receipt and processingPage 31object ActorDemo6 extends Application { val service = actor {def doWork() { // here the actual work is done val service = self actor { Thread.sleep(100) service ! "Serve" } } var served = 0 doWork()loop { // here messages are processed react { case "Serve" => println("I am serving"); served += 1 if (served < 3) doWork () case msg => println(msg) } } } service ! “Serve"}
  • 32. Example - Actors in Scala: Using SchedulersDevelopers may override the scheduler method from the Actor traitFor example, SingleThreadedScheduler maps the actor always to the same (main) threadPer default the ForkJoinScheduler is appliedPage 32class Starship (val id : String) extends Actor {override def scheduler = scala.actors.scheduler.SingleThreadedScheduler private[this] var speed = 0 def act() { var continue = true loopWhile(true == continue) { react { case msg : String => println("Received: " + msg) case STOP => println("stopping"); continue = false case ACCELERATE => speed += 1; println("New speed is Warp " + speed) } } }}
  • 33. Example - Actors in Scala: Using DaemonsDaemon actors provides the same interface such as actors, butThe application may exit even if daemon actors are still runningOn the other hand, an application will wait for running actors to terminateIn addition we might use lightweight reactors (do not transmit the sender with each message, may only use react) or ReplyReactors (senders are passed)Page 33class Starship (val id : String) extends DaemonActor { private[this] var speed = 0 def act() { var continue = true loopWhile(true == continue) { react { case msg : String => println("Received: " + msg) case STOP => println("stopping"); continue = false case ACCELERATE => speed += 1; println("New speed is Warp " + speed) } } }}
  • 34. Example - Actors in Scala: Back to the FutureWith Futures we can receive a reply from an actor asynchronouslyWe need to use the !! operator which returns an objectUsing isSet on this object tells whether result is already availablePage 34case object STOPclass Echo extends Actor { def act() { var continue = true while(continue) { receive { case msg : String => Thread.sleep(1000); sender ! msg case STOP => println("stopping"); continue = false } } }}object Future extends Application { val echo = new Echo; echo.startval replyMsg = echo !! "Hello OOP" println(replyMsg) println(replyMsg()) // get the result echo ! STOP}[info] == run ==[info] Running Future<function0>Hello OOPstopping[info] == run ==[success] Successful..
  • 35. Example - Actors in Scala: Remote Actors ServerRemote Actors can interact across machine or process boundariesThe server needs to register itselfPage 35import scala.actors.Actor._import scala.actors.remote.RemoteActor._object Server { def remoteShip(ship : String, name: Symbol) = actor { alive(8888) register(name, self) var continue = true; var speed = 0 loopWhile(continue) { react {case"Stop" => println("Scotty is stopping"); continue = false case msg : String => println("Uhura received: " + msg)case i : Int => speed += i; println("Spock reports warp speed " + speed) } } } def main(args : Array[String]) { remoteShip("Enterprise", 'enterprise) }}
  • 36. Example - Actors in Scala: Remote Actors Client The client connects to the remote node, ...... selects an actor on this node,and sends messages to the remote actorPage 36import scala.actors.Actor._import scala.actors.remote._import scala.actors.remote.RemoteActor._object Client extends Application {val node = Node("127.0.0.1", 8888) actor {val ship = select(node, 'enterprise) ship ! "Hello" for (i <- 1 to 9) ship ! i ship ! "Stop" } }[info] Running ServerUhura received: HelloSpock reports warp speed 4Spock reports warp speed 5Spock reports warp speed 1Spock reports warp speed 6Spock reports warp speed 2Spock reports warp speed 7Spock reports warp speed 3Spock reports warp speed 8Spock reports warp speed 9Scotty is stopping[info] == run ==[success] Successfull.
  • 37. Example - Actors in Scala: Concurrency Example (1)Example taken from Programming Scala by Venkat SubramaniamTask: find if number is perfect It is perfect  its factors sum up to be twice the numberInstead of using a single-threaded algorithm to check we are using multiple actorsThe number is partitioned into n ranges each of which an actor analyzesKind of Map-Reduce / Master-Slave approach Page 37..........1 to 10002001 to 30001001 to 2000
  • 38. Example - Actors in Scala: Concurrency Example (2)Page 38def sumOfFactors(number: Int) = { (0 /: (1 to number)) { (sum, i) => if (number % i == 0) sum + i else sum }}def isPerfect(candidate: Int) = { 2 * candidate == sumOfFactors(candidate) }def sumOfFactorsInRange(lower: Int, upper: Int, number: Int) = { (0 /: (lower to upper)) { (sum, i) => if (number % i == 0) sum + i else sum }}def isPerfectConcurrent(candidate: Int) = { val RANGE = 1000000 val numberOfPartitions = (candidate.toDouble / RANGE).ceil.toInt val caller = self for (i <- 0 until numberOfPartitions) { val lower = i * RANGE + 1; val upper = candidate min (i + 1) * RANGE actor { caller ! sumOfFactorsInRange(lower, upper, candidate) }} val sum = (0 /: (0 until numberOfPartitions)) { (partialSum, i) => receive { case sumInRange : Int => partialSum + sumInRange }} 2 * candidate == sum}
  • 39. Actors to the Limits - Akka for ScalaAkka provides a much more extensive Actor library developed by Jonas BonérOffers typed and untyped actorsSupports STM and TransactorsAllows searching for actors in its registryProvides Oz-like Dataflow concurrencyAnd moreErlang-like Fault ToleranceSerialization of actors and their referencesAdd-on modules for OSGi, Camel, JTA, ...Page 39
  • 40. Example - Actors in F#The functional programming language F# (standard language in Visual Studio 2010) also supports Actor-based programmingPage 40open Systemlet mailbox = MailboxProcessor.Start(fun mb -> let rec loop x = async { let! msg = mb.Receive() printfn "I received: %s" msg return! loop x } loop 0)mailbox.Post("Hallo")mailbox.Post(“OOP“)Console.ReadLine() |> ignore
  • 41. Example - Actors in ErlangErlang - the first commercially relevant language that introduced actors (language feature)Scala inherited this approachPage 41module_as_actor(E) when is_record(E, event) -> case lists:keysearch(mfa, 1, E#event.contents) of {value, {mfa, {M, F, _A}}} -> case lists:keysearch(pam_result, 1, E#event.contents) of {value, {pam_result, {M2, _F2, _A2}}} -> {true, E#event{label = F, from = M2, to = M}}; _ -> {true, E#event{label = F, from = M, to = M}} end; _ -> false end.
  • 42. Alternative Approach: Using a DSL such as Microsoft AxumPage 42Available for .NETIncubator projectActor definition in Axum, Code also in other .NET languagesDomainDomainShared StateShared Statechannel ChAddition{ input int Add; output int Sum; Start: { Add -> S1; } S1: { Sum -> End; }}Reader AgentWriterAgentAgent:ReaderWriterAgentChannel w/ protocolAgent:Readerdomain A{intaccu; int sum(int op) { } agent Z : ChAddition{ }}Reader AgentsWriterAgentWriterAgentWriterAgentSchemaSchemaMicrosoft C++ developers should look at the AAL (Asynchronous Agents Library)
  • 43. Different Actor Frameworks for Java availableAkkaActorFoundryActor‘s Guild JetlangKilimPage 43Example from Akka Web site http://akkasource.org/// server codeclass HelloWorldActor extends UntypedActor { public void onReceive(Object msg) { getContext().reply(msg + " World"); }}RemoteNode.start("localhost", 9999).register( "hello-service", actorOf(HelloWorldActor.class);// client codeActorRef actor = RemoteClient.actorFor( "hello-service", "localhost", 9999);Object res = actor.sendRequestReply("Hello");
  • 44. Some Possible Liabilities of Actors*In the pure actor model there is no notion of behavior inheritanceDynamic creation of new actors leads to expansion of statenecessity to decide about where to run and store a new actormaybe new communication channelsNote: in a purely actor-based model entities such as integers would be actorsDifficulty to replace behavior in an actorWhat about stream-based media?Fortunately, most of these liabilities can be avoided in hybrid OO/Actor modelsPage 44*see http://www.doc.ic.ac.uk/~nd/surprise_97/journal/vol2/pjm2/
  • 45. SummaryMulti-core revolution is pushing developers hard; using self-managed threads and synchronization leads to accidental complexityThe Actor model seems to be a promising alternative for Concurrent ProgrammingNew languages and frameworks mix functional, object-oriented concepts with actorsActors are not the right solution for all problems, e.g., for really stateful tasksIntroduction of actors should follow design of software architecture, especially its concurrency and distribution architecture. Still valid: A fool with a tool is still a foolPage 45