continued init (RE: OTP or not to OTP)
Mon Mar 3 15:29:14 CET 2003
Sean Hinde writes:
> I do believe that we are
> slightly kidding ourselves when we say that Erlang makes concurrent
> programming easy* - it is easy (ish) to make simple 'object' type processes
> but it is possible to get into an enormous mess of deadlocks and so on if
> you try to get too tricky. This to me is another reason why gen_servers and
> so on are a good thing - they stop people trying to get too complex and then
> find that after a couple of months some weird network conition occurs which
> deadlocks the whole thing.
Even with gen_servers, the only thing preventing deadlock in most of
the systems I write is the diagram on my whiteboard of which
gen_servers are allowed to call which other gen_servers. Otherwise
it's too easy to get into this situation:
lookup_something_else() -> gen_server:call(?MODULE, lookup_something_else).
lookup_something() -> gen_server:call(?MODULE, lookup_something).
The positive thing about Erlang is that these types of mistakes almost
always result in a deadlock followed by a timeout (as compared to
corruption, crash or a permanently hung thread).
More information about the erlang-questions