Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between Erlang Actors, Scala Actors and the theoretical concept "Actor"?

As I know, Actor model is a theory about concurrency. Erlang and Scala both implement this theory model, but neither of their implementations are totally conform with the Actor model.

From the perspective of computer scientists, what are the differences between the concept "Actor" in Erlang, Scala and that theoretical model?

like image 410
huron Avatar asked Nov 24 '15 07:11

huron


People also ask

What are Scala actors?

More specifically, in a Scala actor system, actors interact and share information, without any presupposition of sequentiality. The mechanism by which actors share information with one another, and task one another, is message passing.

What are actors in Erlang?

The actor is a computational entity that, in response to a message it receives, can concurrently (1) send a finite number of messages to other actors, (2) create a finite number of new actors, and (3) designate the behavior to be used for the next message it receives.

Are Goroutines actors?

Goroutines are a simple abstraction of Actors. Actors are just a more specific use-case of Goroutines. You could implement Actors using Goroutines by creating the Goroutine aside a Channel. By deciding that the channel is 'owned' by that Goroutine you're saying that only that Goroutine will consume from it.

What is actor model used for?

The actor model can be used as a framework for modeling, understanding, and reasoning about a wide range of concurrent systems. For example: Electronic mail (email) can be modeled as an actor system. Accounts are modeled as actors and email addresses as actor addresses.


1 Answers

I think the biggest difference is the implementation, I am not sure if it qualifies. In Erlang you have few properties:

  • processes does not share memory, therefore an error in a process cannot directly overflow to another processes
  • the garbage collection is working on a single process at a time, there is not global VM lockup

These are for me the major differences why I think Erlang's actor model is superior to other systems, including Scala.

On the more practical approach, quite often Scala's actor implementation is good enough for the use case. There are few use cases though (maintaining tight latency requirements, for example needing to have the same latency for p99 as p50) where your only option is to use Erlang.

like image 99
Istvan Avatar answered Sep 20 '22 17:09

Istvan