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.

  1. #include<signal.h>
  2. #include<string.h>
  3. #include<fcntl.h>
  4. #include<sys/stat.h>
  5. #include<stdio.h>
  6. #include<stdlib.h>
  7. #include<unistd.h>
  8. #include<sys/types.h>
  9. #include<sys/resource.h>
  10. #include<time.h>

Zombie Process :

  1. #include”headers.h”
  2. main()
  3. {
  4.         int ret;
  5.         if(fork())
  6.         {//parent
  7.         printf(“In parent process %d.n,getpid());
  8.         while(1);
  9.         sleep(10);
  10.         printf(“parent exited..n);
  11.         }
  12.         else
  13.         {//child
  14.         printf(“In child process %d.t parent PID :%d..n,getpid(),getppid());
  15.         sleep(3);
  16.         printf(“In child process %d.t parent PID :%d..n,getpid(),getppid());
  17.         }
  18. }

Venkatesh

Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

Leave a Reply