Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: multiprocessing help

Thread Tools

Re: multiprocessing help

Dennis Lee Bieber
Posts: n/a
On Wed, 7 Nov 2012 09:52:35 +0900, Stephen Bunn <(E-Mail Removed)>
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:
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

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 Removed) HTTP://

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: multiprocessing help Terry Reedy Python 0 11-07-2012 04:11 AM
Re: multiprocessing help Terry Reedy Python 0 11-07-2012 04:04 AM
Need help with multiprocessing.manager and passing the manager amultiprocessing.Connection Metalone Python 0 01-06-2010 07:26 PM
Re: Newbie help for using multiprocessing and subprocess packages forcreating child processes Matt Python 2 06-17-2009 02:33 AM
Newbie help for using multiprocessing and subprocess packages forcreating child processes Rob Newman Python 0 06-16-2009 07:13 PM