Threads vs Processes

sjdevnull at yahoo.com sjdevnull at yahoo.com
Thu Jul 27 03:25:10 EDT 2006


sjdevnull at yahoo.com wrote:
> John Henry wrote:
> > Granted.  Threaded program forces you to think and design your
> > application much more carefully (to avoid race conditions, dead-locks,
> > ...) but there is nothing inherently *non-robust* about threaded
> > applications.
>
> Indeed.  Let's just get rid of all preemptive multitasking while we're
> at it

Also, race conditions and deadlocks are equally bad in multiprocess
solutions as in multithreaded ones.  Any time you're doing parallel
processing you need to consider them.

I'd actually submit that initially writing multiprocess programs
requires more design and forethought, since you need to determine
exactly what you want to share instead of just saying "what the heck,
everything's shared!"  The payoff in terms of getting _correct_
behavior more easily, having much easier maintenance down the line, and
being more robust in the face of program failures (or unforseen
environment issues) is usually well worth it, though there are
certainly some applications where threads are a better choice.




More information about the Python-list mailing list