Guido van Rossum:

Just because Java was once aimed at a set-top box OS that didn't support multiple address spaces, and just because process creation in Windows used to be slow as a dog, doesn't mean that multiple processes (with judicious use of IPC) aren't a much better approach to writing apps for multi-CPU boxes than threads.

I obviously agree.

I don't get it. There's nothing magic that makes process scheduling faster than thread scheduling — on most OS's, a process is just a bag of threads plus an address space (and some other globals), and the kernel schedules all threads of all processes against each other. Switching from multiple threads to multiple processes is merely a choice to _copy_ state rather than _sharing_ it -- instead of multiple threads using the resources of a single interpreter, each thread ends up with its own copy. Sure, this reduces contention. But it multiplies the memory overhead (which itself has serious implications for performance, at least on desktop OS's which are typically RAM-starved). And since these tasks are probably going to need to communicate with each other, you need a lot of IPC, which can add significant overhead, especially if you want to use higher-level communication like remote method invocation. Admittedly, some of these points are non-issues for web servers, where the server tasks don't need to communicate much, and everyone's used to throwing massive amounts of RAM at performance problems. But there's more to life than web servers.

Posted by Jens Alfke on 2007-05-09

Jens,

...merely a choice to _copy_ state rather than _sharing_ it...

I think "merely" needs to be added to the list of alarm bell phrases.

And since these tasks are probably going to need to communicate with each other, you need a lot of IPC, which can add significant overhead

Not really, if it's done right, and presuming you don't need to scale. If you do need to scale, than all that IPC becomes inter-machine communication.

...especially if you want to use higher-level communication like remote method invocation.

You must be new here.

Posted by Joe on 2007-05-09

Applicative trumps imperative in the large. There is various evidence of this in all sorts of different areas.

Posted by Aristotle Pagaltzis on 2007-05-09