Feeds:
Posts
Comments

Archive for August, 2007

I just got done reading this blog post from Roman Shaposhnik and was shocked. Most everything he says is true, threads are not the answer. Sharing memory and having side effects are obviously bad news for parallel programs, not to mention sequential programs as well.

He talks about locks, deadlocks, race conditions, determinism and more. But he also claims that there is no fix for these problems yet. There is! Erlang (yes, there are other languages that work similar to Erlang) does not have any of these problems. If you want to write concurrent programs you need single assignment variables and no shared memory. It makes it easier, safer and it is just plain wasteful to not do it this way. People are going to spend forever debugging code, writing excessive code, just because their way of doing it is inherently wrong.

How does concurrency work in the real world? There is no shared space in our brains, but we can work together by speaking or using other forms of getting a message across. Message passing! Erlang makes this a breeze making writing concurrent programs easier in the same way object oriented programming did (though I’m not fan of OOPs). Sending a message is as simple as:

PID ! {do_something_with_this, List}

My guess is people don’t want to leave their language, their safe place. As will become obvious as people bolt on attempts to make their language safe for concurrent programming. Don’t do it! Start over.

In conclusion, don’t share memory and don’t change the value of a variable, it will make everyones life a hell of a lot easier.Anyone looking to write concurrent applications should check out Erlang. It is the only sane way to do it.

Read Full Post »

Follow

Get every new post delivered to your Inbox.