Re: [PHP] Re: process creation



Per Jessen wrote:
Török Alpár wrote:

as i said it's hate here, and i might be wrong but consider the
following :

for($icount=0;$icount<11;$icount++)
{
$iPid = pcntl_fork();
$iChildrenCount = 0;
if ($iPid == 0)
{
// child
echo ("child $icount\n");
}
else
{
// parrent
}
}

this is essential what you do in your example? If so, this code does
not start 10 children. It starts more.

Thats right - with the code above, each new child will continue creating
more processes. To get exactly 10 children running the same code:

if ($iPid == 0)
{
// child
echo ("child $icount\n");

// do childish stuff
// then exit
exit;
}


/Per Jessen, Zürich


for($icount=0;$icount<11;$icount++)

Iterates 10 times??
Hmm
.



Relevant Pages

  • Re: unix shell script ignores exit when in function that is piped to tee
    ... > Script ignores 'exit' when called from within a function that is ... echo THIS SHOULDNT SHOW UP BECAUSE SUBSHELL HAS EXITED ... of the command to be executed in a child process, and the stdout of that child ... process is fed into the stdin of the parent process that's running the right ...
    (comp.unix.shell)
  • Re: [PHP] Re: process creation
    ... $iPid = pcntl_fork; ... echo ("child $icount\n"); ... Does php allow an app to create/start a process/application that can ... apps would be in a zombie status, and couldn't be killed by an external ...
    (php.general)
  • Re: python with echo
    ... What operating system are you using? ... the documentation for echo and the shell to see why it is returning ... In some OSs the exit status consists of 2 fields, one being the child ...
    (comp.lang.python)
  • Re: [PHP] Re: process creation
    ... $iPid = pcntl_fork; ... echo ("child $icount\n"); ... // then exit ...
    (php.general)
  • Re: Should parents WIFSIGNALED(siginfo->si_status) be true EVEN IF the SIGNAL was caught by the
    ... Since the exit() will cause a SIGCHLD to the parent, ... returns true if the child process was terminated by a signal. ... to terminate. ...
    (Linux-Kernel)