Is it easy to write traditional concurrency proble

2019-04-10 16:19发布

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

2条回答
该账号已被封号
2楼-- · 2019-04-10 16:48

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

查看更多
来,给爷笑一个
3楼-- · 2019-04-10 17:00

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".

查看更多
登录 后发表回答