Zombie process in linux | Zombie implementation in C | Linux process types
Headers.h file contains this headers.. Instead of writing all headers in Every program i am maintaining one file for headers and including that file to program this file is in the folder where source code is there so i don’t need to give any paths.
-
#include<signal.h>
-
#include<string.h>
-
#include<fcntl.h>
-
#include<sys/stat.h>
-
#include<stdio.h>
-
#include<stdlib.h>
-
#include<unistd.h>
-
#include<sys/types.h>
-
#include<sys/resource.h>
-
#include<time.h>
Zombie Process :
-
#include”headers.h”
-
main()
-
{
-
int ret;
-
if(fork())
-
{//parent
-
printf(“In parent process %d.n“,getpid());
-
while(1);
-
sleep(10);
-
printf(“parent exited..n“);
-
}
-
else
-
{//child
-
printf(“In child process %d.t parent PID :%d..n“,getpid(),getppid());
-
sleep(3);
-
printf(“In child process %d.t parent PID :%d..n“,getpid(),getppid());
-
}
-
}