running functions

Scott David Daniels scott.daniels at acm.org
Fri Nov 18 02:18:30 CET 2005


Gorlon the Impossible wrote:

> I have to agree with you there. Threading is working out great for me
> so far. The multiprocess thing has just baffled me, but then again I'm
> learning. Any tips or suggestions offered are appreciated...

The reason multiprocess is easier is that you have enforced separation.
Multiple processes / threads / whatever that share reads and writes
into shared memory are rife with irreproducible bugs and untestable
code.  Processes must be explicit about their sharing (which is where
the bugs occur), so those parts of the code cane be examined carefully.
If you program threads with shared nothing and communication over Queues
you are, in effect, using processes.  If all you share is read-only
memory, similarly, you are doing "easy" stuff and can get away with it.
In all other cases you need to know things like "which operations are
indivisible" and "what happens if I read part of this from before an
update and the other after the update completes, .....

That is why threads that don't do trivial things are so scary.

--Scott David Daniels
scott.daniels at acm.org



More information about the Python-list mailing list