Zombie Process
Zombie means undead. Funda here is very simple,
->when process exit, its return status is collected by its parent
->IN case of orphan prcess, when child exits the parent is in sleep state and will not collect the status of the child
->as child status is uncollected, it cannot be cleared from system table and its occupies some of the system resources
->So its bad house keeping, as zombie is taking one process id etc.
*/
#include
int main()
{
int pid;
if(0==fork())
{
printf("Child Process [%d] Parent [%d]\n",getpid(), getppid());
printf("\n Check process table \n");
}
else
{
/*Parent immediatly spleeps and after child finishes you can check
process talbe there would be child process with defunct
*/
sleep(20);
printf("\n Parent waking up \n");
printf("Parent Process [%d] Parent [%d]\n",getpid(), getppid());
}
return 0;
}
No comments:
Post a Comment