So I want to do the following:
Set up a daemon that forks a bunch of processes.
So the Daemon forks a bunch of processes then forks another bunch of processes
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?
The parent process (the daemon) does something like this:
while(true)
{
SQL QUERY EXECUTED
while(mysql_fetch_array)
{
Fork children
}
}
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.
I am using the System daemon PEAR function to create the daemon and the pcntl_fork
function to create the processes.