shiv@ubuntu:~/ds/unix$ cat zmb.c
/*
* simple program to create a Zombie
* ps command display Zombie with Z under flags in ps output
*/
#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
int main()
{
pid_t pid;
/* create child process */
pid=fork();
if(pid == 0){
/* child process exits and becomes Zombie
*/
exit(0);
}
sleep(20);
printf("Done ....\n");
return 0;
}

/*
* simple program to create a Zombie
* ps command display Zombie with Z under flags in ps output
*/
#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
int main()
{
pid_t pid;
/* create child process */
pid=fork();
if(pid == 0){
/* child process exits and becomes Zombie
*/
exit(0);
}
sleep(20);
printf("Done ....\n");
return 0;
}
Comments
Post a Comment