33
$\begingroup$

I'm trying to wrap my head around what the real differences between the Actor Model of concurrency and Communicating Sequential Processes (CSP) model of concurrency.

So far the best that I have been able to come up with is that the Actor Model allows the number and layout of nodes to change while CSP has a fixed structure of nodes.

$\endgroup$
3
  • 1
    $\begingroup$ See also The Actor Model at ~14:45 on Channel 9, where Carl Hewitt discusses the Actor Model in some depth. He notes a difference between actors and CSP is the use of channels for communication in CSP versus direct communication in the Actor Model. $\endgroup$
    – Whymarrh
    Commented Jul 12, 2015 at 17:02
  • $\begingroup$ @Whymarrh Interestingly, the original CSP paper cs.cmu.edu/~crary/819-f09/Hoare78.pdf doesn't seem to make channels an integral part of the proposal. Processes are supposed to directly talk to each other by their names (though in a synchronous fashion). So I guess if the comparison is between current iterations of the idea, e.g. as seen in Golang or Clojure's core.async, then this is true, but Daniel's answer about the synchronous nature of the communication seems more accurate regarding the original CSP idea. $\endgroup$
    – xji
    Commented May 13, 2022 at 21:27
  • $\begingroup$ Though the WP article en.wikipedia.org/wiki/Communicating_sequential_processes and a summary springer.com/computer/theoretical+computer+science/… does mention that it has evolved substantially since Hoare originally proposed it in 1978, so probably now it indeed always refers to implementations using channels. $\endgroup$
    – xji
    Commented May 13, 2022 at 22:10

2 Answers 2

22
$\begingroup$

I believe one core difference is that in CSP, processes synchronize when messages are received (i.e. a message cannot be sent from one process unless another process is in a receiving mode), while the Actor model is inherently asynchronous (i.e. messages are immediately sent to other processes' address, irrespective of whether they're actively waiting on a message or not).

There should be another answer that is more well-developed, however.

$\endgroup$
10
  • 1
    $\begingroup$ That's pretty much the answer I would have written. In the original actor model (Hewitt, Agha), the receiving process did not even automatically provide access to the name of the sender, though more modern realisations (such as Scala's actors) do. The other difference is that actors enable the sending of actor ids in the messages, as hinted in the question, whereas this is not possible in CSP. (Also possible in the pi-calculus, but not in CCS.) $\endgroup$ Commented Aug 17, 2010 at 18:30
  • 1
    $\begingroup$ So, basically, it's all about the mailbox? $\endgroup$ Commented Sep 3, 2010 at 22:29
  • $\begingroup$ What about the differences listed here: en.wikipedia.org/wiki/… and en.wikipedia.org/wiki/… ? Another important difference, for earlier versions of CSP, is unbounded nondeterminism (see those links). $\endgroup$ Commented Sep 9, 2010 at 3:24
  • 4
    $\begingroup$ I'm not sure if this the core difference, since CSP can have buffered channels allowing asynchronous message sending. Perhaps it's more about the process id, in CSP processes are anonymous, while actors are named. $\endgroup$ Commented Aug 17, 2015 at 2:39
  • $\begingroup$ @CMCDragonkai It seems that in the original CSP paper, cs.cmu.edu/~crary/819-f09/Hoare78.pdf, explicitly addresses these two points: $\endgroup$
    – xji
    Commented May 13, 2022 at 21:18
1
$\begingroup$

CSP is roughly like processes communicating via TCP connections (sender blocks until the receiver ACKed), the actor model is roughly like processes communicating via UDP (you send packets and hope for the best).

If the platform has guarenteed delivery (unlike network protocols, but like Kafka or messages via the file system), the actor model becomes quite a bit more powerful and allows for temporal decoupling. So a pipeline of actors does not strictly require the actors themselves to even exist at the same time as long as their mailboxes exist, you could run them sequentially one after another.

CSP by contrast would require an explicit adapter that can serialize/deserialize messages if you want temporal decoupling (and serialization would be outside of CSP proper), though with one-way channels that is easy to do. Alternatively, you can extend CSP with buffered channels (only block and wait for an ACK after >=N unacknowledged messages) which also allows some temporal decoupling.

$\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.