threading support in python

Paul Rubin http
Mon Sep 4 16:06:31 EDT 2006


"sjdevnull at yahoo.com" <sjdevnull at yahoo.com> writes:
> If it's read/write data or you're not on a Unix platform, you can use
> shared memory to shared it between many processes.
> 
> Threads are way overused in modern multiexecution programming.  The
> decision on whether to use processes or threads should come down to
> whether you want to share everything, or whether you have specific
> pieces of data you want to share.

Shared memory means there's a byte vector (the shared memory region)
accessible to multiple processes.  The processes don't use the same
machine addresses to reference the vector.  Any data structures
(e.g. those containing pointers) shared between the processes have to
be marshalled in and out of the byte vector instead of being accessed
normally.  Any live objects such as open sockets have to be shared
some other way.  It's not a matter of sharing "everything"; shared
memory is a pain in the neck even to share a single object.  These
things really can be easier with threads.



More information about the Python-list mailing list