/*********************************************************************************
|
* Copyright: (C) 2025 LingYun IoT System Studio
|
* All rights reserved.
|
*
|
* Filename: zombie.c
|
* Description: This file is zombie process example.
|
*
|
* Version: 1.0.0(10/28/2025)
|
* Author: Guo Wenxue <guowenxue@gmail.com>
|
* ChangeLog: 1, Release initial version on "10/28/2025 09:51:27 AM"
|
*
|
********************************************************************************/
|
|
#include <stdio.h>
|
#include <unistd.h>
|
|
int main(void)
|
{
|
pid_t pid = fork();
|
|
if (pid == 0)
|
{
|
printf("Child process exit\n");
|
_exit(0);
|
}
|
else
|
{
|
sleep(5); /* 父进程延迟不回收子进程 */
|
printf("Parent process done\n");
|
}
|
|
return 0;
|
}
|