[Python-Dev] ActiveState & fork & Perl

David Ascher da at ski.org
Mon Jun 7 19:02:31 CEST 1999


On Mon, 7 Jun 1999, Guido van Rossum wrote:

> Can you give a typical example where you use it, or is this just a gut
> feeling?

Well, the latest example was that I wanted to spawn a Python process to do
viewing of NumPy arrays with Tk from within the Python interactive shell
(without using a shell wrapper).  It's trivial with a fork(), and
non-trivial with threads.  The solution I had to finalize on was to branch
based on OS and do threads where threads are available and fork()
otherwise.  Likely 2.05 times as many errors as with a single solution =).

> It's also dangerous -- e.g. unexpected errors may percolate down the
> wrong stack (many mailman bugs had to do with forking), GUI apps
> generally won't be cloned, and some extension libraries don't like to
> be cloned either (e.g. ILU).

More dangerous than threads?  Bwaaahaahaa! =).  fork() might be
"deceivingly simple in appearance", I grant you that.  But sometimes
that's good enough.  

It's also possible that fork() without all of its process-handling
relatives isn't useful enough to warrant the effort.

--david





More information about the Python-Dev mailing list