Wiger on Erlang-style Concurrency

February 7th, 2008  |  Published in concurrency, erlang, HTTP, messaging  |  3 Comments  |  Bookmark on Pinboard.in

Since a number of people seem to be experimenting with adding Erlang-style concurrency to other languages, Ulf Wiger has written a nice explanation of what Erlang-style concurrency actually is. Definitely informative.

On a related note, I chuckled when I saw this posting from Robert Virding, who helped create Erlang, in the erlang-questions list about a month ago:

After reading the blogs about how good Erlang’s concurrency model is and how we just just made a super implementation of it in XXX I have been led to formulate Virding’s First Rule of Programming:

Any sufficiently complicated concurrent program in another language contains an ad hoc informally-specified bug-ridden slow implementation of half of Erlang.

This is, of course, a mild travesty of Greenspun but I think it is fundamental enough to be my first rule, not the tenth.

I can understand where he’s coming from. When I see the kind of blog postings he’s referring to, I always wonder why they don’t just use Erlang itself instead of trying to reinvent it in another system whose design trade-offs are unlikely to be able to support it. Well, I guess it would make sense in the case where they’re specifically studying various implementations of concurrency, but other than that, I don’t get it.

On another related note, I found the comment below in another blog. It refers specifically to my own use of Erlang:

it’s [sic] be interesting to see how Steve mix [sic] Erlang and HTTP, since Erlang is asynchronous in nature and does not have any “resource” concept and HTTP’s sweet spots are just the opposite

That’s easy. If you want to experience HTTP as implemented in Erlang, just go to the Yaws website, which of course is powered by Yaws itself. As Ulf’s blog posting explains, Erlang message passing is asynchronous, but that really has nothing to do with Erlang’s ability to support protocols like HTTP. For example, when I was learning Erlang, given my CORBA background I wrote a subset of IIOP, and it was really quite easy. Furthermore, Erlang doesn’t need a “resource” concept to support HTTP. A resource in that context is, after all, ultimately just a chunk of code that processes incoming requests, and of course Erlang can do that.

If you want to know more, go pick up Joe Armstrong’s Erlang book — it’s quite excellent.

Responses

  1. Anthony Tarlano says:

    February 7th, 2008 at 11:03 am (#)

    Inevitably all good concurrent applications handle partial ordering of execution in some coordinated fashion.

    Last year I took a 6 month dive into Erlang. I found it a very pleasant experience and its functional style really turned me on.

    It wasn’t my first CO/COPL language, since I had used Limbo (from Inferno) and Occam in the past.

    Erlang was however the first that put forth, front and center, the notion of explicitly designing using a supervisor model and hierarchies of supervision trees for coordination. This is a real gem that Erlang brings to the table and speaks to me as a key architecture abstraction for coordination.

    Recently, I have been diving into the Concurrency and Coordination Runtime (CCR) from the MSRS folks over at Microsoft. I recommend giving it a look if you can grab a couple minutes since it brings something very nice to .NET ;)

    Tony

  2. MikeD says:

    February 7th, 2008 at 12:22 pm (#)

    Ah, how I wish I had the time to build an HTTP based messaging system with Erlang. Sort of like XMPP but without angle brackets.

  3. Patrick Logan says:

    February 7th, 2008 at 2:35 pm (#)

    “it’s [sic] be interesting to see how Steve mix [sic] Erlang and HTTP, since Erlang is asynchronous in nature and does not have any “resource” concept and HTTP’s sweet spots are just the opposite”

    Oh, dear.