title: killing zombie children in parent processes
body: <p>So I want to do the following:<br>
  Set up a daemon that forks a bunch of processes.</p>
  
  <p>So the Daemon forks a bunch of processes
  then forks another bunch of processes</p>
  
  <p>the problem is the child processes might take a long time to exit. How do I prevent zombie children if the parent process has other work to do despite forking children? </p>
  
  <p>The parent process (the daemon) does something like this:</p>
  
  <pre><code>while(true)
  {
  SQL QUERY EXECUTED
  
     while(mysql_fetch_array)
     {
         Fork children
     }
  }
  </code></pre>
  
  <p>The problem is how can I wait for the children processes to exit if the parent process has to do other work besides forking children and if the children take a long time to exit.</p>
  
  <p>I am using the System daemon PEAR function to create the daemon and the <code>pcntl_fork</code> function to create the processes.</p>