SPUG: kill or exit multiple processes

Jim Flanagan jimfl at tensegrity.net
Tue Aug 27 12:16:40 CDT 2002


On Tue, 27 Aug 2002, Meryll Larkin wrote:

      > Now I'm confused because I assumed that if Program B
      > spawned Program C that Program B's PID (process ID) would
      > be the PPID (parent process ID) to Program C.

  Yes.

      > I also thought that if Program B was killed, that killing
      > the parent would kill the child (Program C).

  No. How do you think deamons are born? It's very common for parents to
  die, and their children live on ("and even have itty-bitty litte children
  of their own." (+5 pts if you get the move reference)).

  However, you can kill a process group, by setting up the parent as the 
  process grou leader, then using kill to kill (or send any signal) to 
  the entire group.

  The common way to set up a process as the process group leader is to 
  use setsid(2) or setpgid(2), depending upon your OS. Also, usually,
  using kill with a negative pid sends the signal to the process group,
  instead of the process.

    http://jimfl.tensegrity.net
  mailto:jimfl%40t%65ns%65gr%69ty.n%65t


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org




More information about the spug-list mailing list