Re: multiprocessing help

Discussion in 'Python' started by Dennis Lee Bieber, Nov 7, 2012.

  1. On Wed, 7 Nov 2012 09:52:35 +0900, Stephen Bunn <>
    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
    HTTP://wlfraed.home.netcom.com/
     
    Dennis Lee Bieber, Nov 7, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rob Newman
    Replies:
    0
    Views:
    1,023
    Rob Newman
    Jun 16, 2009
  2. Matt
    Replies:
    2
    Views:
    442
    Mike Kazantsev
    Jun 17, 2009
  3. Metalone
    Replies:
    0
    Views:
    365
    Metalone
    Jan 6, 2010
  4. Terry Reedy

    Re: multiprocessing help

    Terry Reedy, Nov 7, 2012, in forum: Python
    Replies:
    0
    Views:
    147
    Terry Reedy
    Nov 7, 2012
  5. Terry Reedy

    Re: multiprocessing help

    Terry Reedy, Nov 7, 2012, in forum: Python
    Replies:
    0
    Views:
    133
    Terry Reedy
    Nov 7, 2012
Loading...

Share This Page