Is Communicating Sequential Processes [CSP] an alternative to the actor model in Scala?
Asked Answered
S

1

12

In a 1978 Paper by Hoare we have an idea called Communicating Sequential Processes. This is used by Go, Occam, and in Clojure in core.async.

Is it possible to use CSP as an alternative to the Actor Model in Scala? (I'm seeing JCSP but I'm wondering if this is the only option, if it is mature, and if anyone uses it).

EDIT - I'm also seeing Communicating Scala Objects as an alternative to JCSP in Scala. But those of these seem to be tied to real threads - which seems to miss one of the benefits of CSP, being to get away from the memory resource cost of keeping large numbers of threads always active.

Salvo answered 24/11, 2013 at 5:29 Comment(1)
a brief description for future - medium.com/@ssumit/…Lounging
S
2

You should consult this document, but in general there are a few differences:

  • Channels are anonymous while actors have identities
  • In CSP, you use channels to transmit messages, but actors can directly contact each other.
  • In CSP communication is done in the form of rendezvous (i.e., it is synchronous). Actors support asynchronous message passing.

And yes, it is possible to use CSP as an alternative to the Actor model if these differences are acceptable in your position. I don't have any experience with JCSP but I wouldn't recommend using that specific library (the reason is as I see there aren't any activity in the project since 2011).

Solenoid answered 6/12, 2013 at 11:19 Comment(1)
In CSP, Channels are not anonymous. CSP is a process algebra so processes can be represented by a variable or an expression. Implementations of CSP may have anonymous processes.Cladoceran

© 2022 - 2024 — McMap. All rights reserved.