Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8283505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:45:28+00:00 2026-06-08T10:45:28+00:00

As I have not waited for the children process in the following code, but

  • 0

As I have not waited for the children process in the following code, but there is no zombie process after running, so why?
In my understanding, zombie process generated in this condition: parent process exits without calling ‘wait’ or ‘waitpid’ for its children, so the system process init picks up these children process, which are called zombie process, isn’t right?

<?php
define("PC", 10); // Process Count

if (!function_exists('posix_mkfifo')) {
    die("posix_mkfifo not existing\n");
}
if (!function_exists('pcntl_fork')) {
    die("pcntl_fork not existing");
}

// create pipe
$sPipePath = "my_pipe.".posix_getpid();
if (!posix_mkfifo($sPipePath, 0666)) {
    die("create pipe {$sPipePath} error");
}

$arrPID = array();
for ($i = 0; $i < PC; ++$i ) {
    $nPID = pcntl_fork(); // create a child process
    if ($nPID == 0) {
        // children
        $oW = fopen($sPipePath, 'w');
        fwrite($oW, $i."\n");
        fclose($oW);
        exit(0); // child end
    }elseif($nPID > 0) {
        // parent
        //array_push($arrPID, $nPID);
        //while($pid = pcntl_wait($nStatus, WNOHANG OR WUNTRACED) > 0) {
            //echo "$pid exit\n";
        //}
    }

}
// wait for all child process
//foreach($arrPID as $nPID){
    //echo "$nPID\n";
    //pcntl_waitpid($nPID, $nStatus); // cause process undead
    //pcntl_wait($nStatus);
//}

// parent
$oR = fopen($sPipePath, 'r');
$sData = '';
while(!feof($oR)) {
    $sData .= fread($oR, 1024);
}
fclose($oR);
unlink($sPipePath); // remove pipe


//check result
$arr2 = explode("\n", $sData);
$map = array();
foreach($arr2 as $i) {
    if (is_numeric(trim($i))) {
        $map[trim($i)] = '';
    }
}
echo count($map) == PC ? 'ok' : "error count " . count($map);
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T10:45:31+00:00Added an answer on June 8, 2026 at 10:45 am

    They’re only zombie processes until their parent either reaps them or dies. Once they’ve been reparented to init they are reaped and so no longer exist.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have waited for more than 72 hours but ecommerce data is not tracked.
have not tested on windows. but in ubuntu when u disconnect from the network,
I have not had to do something like this in the past and am
I have not started creating the code so I don't have anything to show,
I have not been able to find any definitive answers to this question: Can
this is a small, but very annoying , glitch in my form. I have
I have a MySQL table like this: CREATE TABLE categories ( ID INT NOT
I have the following function, when I call it's printing out the mess but
GAE 1.5.5 looks to have some excellent, long-waited for features. However, they're not working
I have been running a webserver for some years now but recently it started

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.