Hey guys i need help on this problem ....
Please tell me how to create zombie in linux using fork() ?
when parent process issues a fork system call, it spawns a child process.
Idly parent should query the exit status of the child process by system calls like waitpid,wait etc.
But if parent process fails to do this or never issues such calls and just get terminate, then child process is said to be zombie(other name is orphan) i.e process having no parent. It just exists in memory holding the resources.
-
int main()
-
{
-
int pid;
-
pid=fork();
-
if(pid>0)//child
-
{
-
sleep(1000);
-
}
-
else//parent
-
{
-
exit(0);
-
}
-
}
-