running functions

Grant Edwards grante at visi.com
Fri Nov 18 02:35:38 CET 2005


On 2005-11-18, Scott David Daniels <scott.daniels at acm.org> wrote:
> 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.

There can be problems, but you make it sound way worse than it
really is.  I've been doing threaded SW for a lot of years
(yikes! almost 25), and it's just not that hard to deal with
shared objects/variables -- especially in Python with its GIL.

I think it's easier and more intuitive than forking.

I've written a lot of (admittedly not huge) Python programs
using threading (some with 30-40 thread), and I don't remember
ever tripping over anything significant.  I think dealing with
shared objects is easier than figuring out how to do
inter-process communications using sockets or Posix shared
memory or whatnot.  It's not difficult if you don't have to do
any communication between processes, but in that case, shared
objects aren't a problem either.

[...]

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

Maybe I've just been using threads too long, but I don't think
they're any more scary than software in general is scary.

-- 
Grant Edwards                   grante             Yow!  I LIKE Aisle 7a.
                                  at               
                               visi.com            



More information about the Python-list mailing list