Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #32866 > unrolled thread

Re: multiprocessing help

Started byDennis Lee Bieber <wlfraed@ix.netcom.com>
First post2012-11-06 23:23 -0500
Last post2012-11-06 23:23 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: multiprocessing help Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-11-06 23:23 -0500

#32866 — Re: multiprocessing help

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2012-11-06 23:23 -0500
SubjectRe: multiprocessing help
Message-ID<mailman.3355.1352262240.27098.python-list@python.org>
On Wed, 7 Nov 2012 09:52:35 +0900, Stephen Bunn <scbunn@sbunn.org>
declaimed the following in gmane.comp.python.general:

> I'm looking for some help with multiprocessing.  Essentially what I'm
> trying to do is the following:
> 
>   1. create a main process that gets daemonized
>   2. spawn two subprocess that live for the life of the daemon

	That sounds backwards to me (presuming daemonized /processes/ are
equivalent to daemonized /threads/). In the threading module, a daemon
thread hangs around until the parent non-daemon thread exits.

	From the 2.7 documentation of multiprocessing:
-=-=-=-
daemon 
The process’s daemon flag, a Boolean value. This must be set before
start() 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. Additionally, these are
not Unix daemons or services, they are normal processes that will be
terminated (and not joined) if non-daemonic processes have exited.
-=-=-=-

	Problem is, you can't reverse your scheme since, if the "step" two
processes were the daemons, they would not be allowed to do

>   3. each subprocess creates children that do heavy work and exit when
> the work is done

this step.


	The only reliable means is for all subprocesses to be looking for a
signal of some sort which tells them to exit on their own part.


-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web