I was looking into concurrent programming in Erlang and Go programming languages. As per my finding they are used Actor model and CSP respectively.
But still I am confused with what are the objective differences between CSP and Actors? is it just theoretical different only but the same concept?
Best Answer
In practice, there is very little difference: both represent separate units of execution whose primary interface with the outside world is via messages.
The differences are in the implementation details of the languages. Here are a few such details:
receive
gets everything sent to the process and must pattern-match (in Go, you would use aselect
with multiple cases, so the code would look very similar, just with different channels).This last point is, I think, the most important. While both use messages as the primary means of communication, Erlang makes much stronger guarantees about how and when state can change.