Architecture – Actor Model vs Producer-Consumer Model

actor-modelArchitecturecscala

I'm doing some early-stage research towards architecting a new software application. Concurrency and multithreading will likely play a significant part, so I've been reading up on the various topics.

The producer-consumer model, at least how it is expressed in Java, has some surface similarities but appears to be deeply dissimilar to the actor model in use with languages such as Erlang and Scala. I'm having trouble finding any good comparative data, or specific reasons to use or avoid the one or the other.

Is the actor model even possible with Java or C#, or do you have do use one of the languages built for the purpose? Is there a third way?

Best Answer

Sure, you could implement an actor-based model in both java and C#. Infact microsoft already did so. You gain a bunch of benefits though if the model is an abstraction directly in the language.

That being said the jury is still out on whether the actor-model will be the concurrency model of the future. Clojure goes with software transactional memory as it's underlying concurrency model.

Personally I think neither the actor model nor STM will end up being the de-facto concurrency model but rather an OOP/functional hybrid programming language with concurrency abstractions built directly into the language.

Related Topic