Structured Concurrency

“This article is a follow-up to the “Getting Rid of State Machines” blog posts, so you may want to read those first:

Before going on, let me return to the fundamentals and make it clear what this effort is all about.

As Joe Armstrong nicely puts it in his blog:

TCP uses the idea a session and the only rational way to program a session is as a process or (horrors) as a thread. […] Session management involves mutable state concurrency. A program that is a dozen lines of Erlang escalates into a mess of locks and mutexes or callbacks which in most languages is a thin layer over a pthreads implementation. For those of you who haven’t written a multi-threaded TCP socket server in C using pthreads I can only say “don’t go there, it’s not a pleasant experience” I’ve been there done that, and have the grey hairs to prove it…”