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:
- actors message passing is asynchronous, CSP message passing is synchronous
- actors are composable, CSP is not (necessarily)
- actors always have unbounded non-determinism, CSP may have bounded or unbounded non-determinism
- actors have variable topology whereas CSP has fixed topology
- actors have the principle of locality, CSP does not have locality
- actors are designed around their behaviour, CSP doesn't not necessarily have this
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
Asked By : hawkeye
Answered By : Martin Berger
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.
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/19506
0 comments:
Post a Comment
Let us know your responses and feedback