Php pcntl_fork exit cannot exit child processes

for ($iBoth / Ipp) {

fork_worker();

}

function fork_worker () {

$pid = pcntl_fork();
if($pid == 0){ //child processes
    echo "\r\n";
    $this_id = getmypid();
    echo  $this_id."\r\n";
    exit(1);
}elseif($pid > 0){ //master processes
    echo "\r\n";
}

}
while (1);
according to reason, the child process is already exit, but when viewing the process, the child process still exists, and the bottom while (1) is only executed in the parent process. After thinking about it for a long time, I didn"t understand it and forgot to help answer the question

.
Php
Aug.27,2021
Menu