Threads vs Processes
Grant Edwards
grante at visi.com
Thu Jul 27 14:07:01 EDT 2006
On 2006-07-27, sjdevnull at yahoo.com <sjdevnull at yahoo.com> wrote:
>> If you're sharing things, I would thread. I would not want to
>> pay the expense of a process.
>
> This is generally a false cost. There are very few
> applications where thread/process startup time is at all a
> fast path,
Even if it were, on any sanely designed OS, there really isn't
any extra expense for a process over a thread.
> Moreover, to get at best a small performance gain you pay a
> huge cost by sacrificing memory protection within the threaded
> process.
Threading most certainly shouldn't be done in some attempt to
improve performance over a multi-process model. It should be
done because it fits the algorithm better. If the execution
contexts don't need to share data and can communicate in a
simple manner, then processes probably make more sense. If the
contexts need to operate jointly on complex shared data, then
threads are usually easier.
--
Grant Edwards grante Yow! My life is a patio
at of fun!
visi.com
More information about the Python-list
mailing list