Wednesday, May 23, 2007
More forays into multiprocessor programming
- From
- "andrew cooke" <XXXXXXXXXXXXXXXXX>
- To
- sean@conman.org
- Subject
- Erlang bugs
- Date
- Wed, 23 May 2007 08:12:35 -0400 (CLT)
Hi,
Found your page (which references my Erlang Sudoku solver) via Technorati.
I can't for the life of me remember exactly what the cause was for the bug that you mention in that post, but I am pretty sure it wasn't to do with messaging or otherwise related to concurrency. A better explanation of why it was hard to track down is that the program is largely “indeterminate” in that the flow of control is unpredictable (because of random choices rather than concurrency itself).
However, when I added extra communication for the “community” version—http://www.acooke.org/cute/CommunityS0.html—that did have serious deadlock issues that were directly related to concurrency. And I was surprised at how easy they were (ie how easy it was to introduce errors)—I had somehow convinced myself that Erlang made everything much safer. In retrospect its advantage is not that Erlang's message passing somehow magically avoids deadlocking, but that (1) it provides a clean framework for thinking about message passing that's nicely isolated and easy to read and manage and (2) assuming you stick to the pure functional parts of the language, state is already explicit and so easier to reason about.
Andrew
(Couldn't see a way to comment on the page, so emailing instead)
Just another datapoint that writing concurrent programs, even in a langauge like Erlang which makes it easy, isn't easy.