views:

190

answers:

2

Hi,

I have followed an operative system course where we learned usual concurrency problems as: the dinning philosophers problem, producer-consumer problem, readers & writers problem...

Since their main purpose is to protect a shared variable, does it make sense to try to solve these problems in Erlang? Or maybe I just need more Erlang training to figure out the solution?

Thanks

+5  A: 

I understand the question, but those problems have to do with locking and mutual exclusion.

Erlang's way of doing things through Actors avoids the locking problem. Creating producers and consumers and readers and writers are a good thing to do in Erlang, but as far as solving the mutual exclusion problem, you would be using messages instead of a shared variable.

In Erlang, you "share nothing".

Kekoa
+1  A: 

This link might help you

It is certain that real world applications of Erlang will have to deal with concurrency, with threads fighting over certain ressources.

There is an excellent book which covers all this subject and many more, written by Joe Armstrong, the creator of Erlang.

Programming Erlang : Software for a concurrent world

Eric