page faults when spawning subprocesses
Daniel Kabs
daniel.kabs at gmx.de
Wed Nov 9 07:17:03 EST 2005
Dave Kirby wrote:
> I am working on a network management program written in python that has
> multiple threads (typically 20+) spawning subprocesses which are used
> to communicate with other systems on the network. ...
Let me check if I got you right: You are using fork() inside a thread in
a multi-threaded environment. That sounds complicated. :-)
Have a look at
http://www.opengroup.org/onlinepubs/009695399/functions/fork.html
It mentions your use of fork, i.e. to create a new process running a
different program (in this case the call to fork() is soon followed by a
call to exec()).
If you fork in your multi-threaded environment, what happens with all
your threads? The document resorts to "the effects of calling functions
that require certain resources between the call to fork() and the call
to an exec function are undefined.". Maybe you are just experiencing
this :-)
The document above recommends: "to avoid errors, the child process may
only execute async-signal-safe operations until such time as one of the
exec functions is called."
Maybe this discussion is also of some help:
http://groups.google.com/group/comp.programming.threads/browse_thread/thread/37fe7e050b44c329/217660515af867ea?tvc=2#217660515af867ea
Cheers
Daniel
More information about the Python-list
mailing list