Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference of the Akka's Actor with Scala's Actor model

Tags:

scala

akka

actor

I found there is also an Akka actor model, so I am wondering what's the difference between the Akka's Actor and Scala's Actor model?

like image 368
Evans Y. Avatar asked Feb 20 '12 09:02

Evans Y.


People also ask

What is Akka actor model?

Akka Actors The Actor Model provides a higher level of abstraction for writing concurrent and distributed systems. It alleviates the developer from having to deal with explicit locking and thread management, making it easier to write correct concurrent and parallel systems.

What is an actor in actor model?

An actor is a computational entity that, in response to a message it receives, can concurrently: send a finite number of messages to other actors; create a finite number of new actors; designate the behavior to be used for the next message it receives.

What is actor model good for?

The actor model abstraction allows you to think about your code in terms of communication, not unlike the exchanges that occur between people in a large organization. Use of actors allows us to: Enforce encapsulation without resorting to locks.

What is actor model in context of a programming language?

The Actor model adopts the philosophy that everything is an actor. This is similar to the everything is an object philosophy used by some object-oriented programming languages, but differs in that object-oriented software is typically executed sequentially, while the Actor model is inherently concurrent.


1 Answers

Well, there isn't. There is just Actor model, and Akka actors and Scala actors are two implementations of that model.

All Actor model says that your concurrency primitives are actors, which can:

  • receive a message and decide what to do next depending on the content of the message, including:

  • send messages to any actors they know about

  • create new actors

and provides certain guarantees, e.g.:

  • any actor will only handle a single message at a time

  • messages sent by actor X to actor Y will arrive in the order thay were sent

There is no difference between Scala and Akka actors on this level.

For differences in what they can do, see Different Scala Actor Implementations Overview. The biggest one, for me, is that Akka supports supervisors and ActorRegistry.

like image 73
Alexey Romanov Avatar answered Sep 19 '22 05:09

Alexey Romanov