<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<dl class="attribute">
<dt id="multiprocessing.Process.daemon">Hello everyone</dt>
</dl>
<br>
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).<br>
<br>
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 ?<br>
<br>
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 ? <br>
<br>
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 ?<br>
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 ?<br>
<br>
Thanks a lot for helping me get rid of my confusion,<br>
regards,<br>
Pascal<br>
<br>
<br>
<dl class="attribute">
<dt id="multiprocessing.Process.daemon"><tt class="descname">=========QUOTES==========</tt></dt>
<dt id="multiprocessing.Process.daemon"><tt class="descname">daemon</tt><a
class="headerlink"
href="http://docs.python.org/library/multiprocessing.html#multiprocessing.Process.daemon"
title="Permalink to this definition">¶</a></dt>
<dd>
<p>The process’s daemon flag, a Boolean value. This must be set
before
<a title="multiprocessing.Process.start" class="reference internal"
href="http://docs.python.org/library/multiprocessing.html#multiprocessing.Process.start"><tt
class="xref docutils literal"><span class="pre">start()</span></tt></a>
is called.</p>
<p>The initial value is inherited from the creating process.</p>
<p>When a process exits, it attempts to terminate all of its
daemonic child
processes.</p>
<p>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.<br>
<br>
----------------------<br>
</p>
</dd>
</dl>
<pre>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.
</pre>
</body>
</html>