17
$\begingroup$

When we look at the Actor Model and Communicating Sequential Processes we see that they are both trying to do concurrency based on message passing, yet they are distinct.

(We see implementations of the CSP Model in go-lang's goroutines (and Clojure's core.async) and the Actor Model in Scala's Akka toolkit)

I'm trying to get a simple list of the differences between the Actor Model and CSP. So far I have:

Is this correct? Is there anything I'm missing?

Assumptions

  • When I say 'actor model' - I mean the theoretical basis behind the implementation in Scala's Akka framework
$\endgroup$
5
  • $\begingroup$ A huge point: In CSP message passing is synchronous; in Actors message passing is asynchronous. $\endgroup$ Commented Jan 5, 2014 at 11:55
  • $\begingroup$ @hawkeye What do you deem to be "the" actor model? Since its informal description, many formalisations have appeared, with somewhat different properties. $\endgroup$ Commented Jan 5, 2014 at 17:10
  • $\begingroup$ @Martin - that's helpful. I've updated my assumptions. Perhaps you can help me find the "one I'm looking for" $\endgroup$
    – hawkeye
    Commented Jan 6, 2014 at 0:38
  • $\begingroup$ @hawkeye What to you mean by the Akka model? Only the key computational mechanism, or also the distributed monitoring/error-handling framework? $\endgroup$ Commented Jan 6, 2014 at 14:13
  • $\begingroup$ @MartinBerger just the key computational mechanism $\endgroup$
    – hawkeye
    Commented Jan 6, 2014 at 22:41

1 Answer 1

6
$\begingroup$

Here is how I think Erlang works. I believe Akka is very similar.

Each process has a single mailbox. Messages are put into the receiver's mailbox by the sender, and fetched by the receiver using pattern matching. This matching process can change message ordering in the sense that the oldest message in a mailbox may not match, but a younger one does. In this case the younger one is consumed first. Other than that, message ordering is preserved.

With this in mind, the asynchronous $\pi$-calculus extended with input pattern matching input from buffer describes Erlang (and hence Akka) semantics accurately, although one needs to do a bit of work in the encoding, since the $\pi$-calculus doesn't have the restriction to single channels per process. However, one usually doesn't want an encoding, but rather a calculus that models the target system directly. Such a calculus exists, and it's called Featherweight Erlang. It is by Mostrous and Vasconcelos. Their paper focusses on typing, but you can ignore that and just look at the untyped calculus in Section 3.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.