Daemonic processes in multiprocessing

Pascal Chambon chambon.pascal at gmail.com
Sat Apr 25 18:52:10 CEST 2009

Hello everyone

I've just read the doc of the (awesome) "multiprocessing" module, and 
there are some little things I don't understand, concerning daemon 
processes (see quotes below).

When a python process exits, the page says it attempts to join all its 
children. Is this just a design choice, or are there constraints behind 
this ? Because normally, when a parent process exits, its child gets 
adopted by init, and that can be useful for creating daemons, can't it ?

Concerning daemons processes, precisely, the manual states that they are 
all terminated when their parent process exits. But isn't it contrary to 
the concept of dameons, which are supposed to have become independent 
from their parent ?

And I don't understand how "the initial value (of the "daemonic" 
attribute) is inherited from the creating process", since "daemonic 
processes are not allowed to create child processes". Isn't it the same 
to say that "daemonic" is always false by default, then ?
And finally, why can't daemonic processes have children ? If these 
children get "orphaned" when the daemonic process gets terminated (by 
its parent), they'll simply get adpoted by init, won't they ?

Thanks a lot for helping me get rid of my confusion,


    The process's daemon flag, a Boolean value. This must be set before
    is called.

    The initial value is inherited from the creating process.

    When a process exits, it attempts to terminate all of its daemonic
    child processes.

    Note that a daemonic process is not allowed to create child
    processes. Otherwise a daemonic process would leave its children
    orphaned if it gets terminated when its parent process exits.


Similarly, if the child process is non-daemonic then the parent
process may hang on exit when it tries to join all its non-daemonic children.
Remember also that non-daemonic
processes will be automatically be joined.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090425/272277b4/attachment.html>

More information about the Python-list mailing list