multiprocessing vs thread performance
Roy Smith
roy at panix.com
Mon Dec 29 10:32:55 EST 2008
In article <mailman.6337.1230563873.3487.python-list at python.org>,
Christian Heimes <lists at cheimes.de> wrote:
> You have missed an important point. A well designed application does
> neither create so many threads nor processes. The creation of a thread
> or forking of a process is an expensive operation. You should use a pool
> of threads or processes.
It's worth noting that forking a new process is usually a much more
expensive operation than creating a thread. Not that I would want to
create 100,000 of either!
Not everybody realizes it, but threads eat up a fair chunk of memory (you
get one stack per thread, which means you need to allocate a hunk of memory
for each stack). I did a quick look around; 256k seems like a common
default stack size. 1 meg wouldn't be unheard of.
More information about the Python-list
mailing list