So says Roman Shaposhnik, frequently referencing Edward E. Lee’s “The Problem with Threads“. I largely agree; threads are not a mechanism that can be effectively used by mere mortals, and we are all, after all, mere mortals. The default everything-is-shared setup seems the exact opposite of what’s needed: default of nothing-is-shared-unless-explicitly-declared.
The sweet spot of scalable Web apps these days is multi-process with explicit sharing via shared-memory (eg. memcached) or messaging. I don’t know if there’s a whole lot wrong with that. We may need easier or more integrated mechanisms for invoking and using the shared memory/messaging, but otherwise it’s a nice model – it’s well understood, scales well to multiple CPUs, and is reliable.
I remember a paper from back in grad school (Joe Pasquale’s operating systems class) that delved into the relative overhead of processes versus threads, making the point that the difference is not that large in modern operating systems. Anybody know of the relative overhead of processes versus, say, Java threads in Linux?
I really need to play more with Erlang and company, there may be interesting insights or programming models there…