When i run a programm of orphan process. Instead of getting child's parent (ppid)=1 ..i get 1400 and it varies as per system.
How can i findthe right soluion???
My pgm:
#include<stdlib.h>
# include <stdio.h>
int main()
{
int pid;
pid=fork();
if(pid < 0)
{exit(-1);}
else if(pid==0)
{
printf("Child Process is Sleeping ...");
sleep(10);
printf("Orphan Child's Parent ID : %u
",getppid());
}
else
{
printf("Parent Process Completed ... %u
",getpid());
exit(0);
}
return 0;
}
Output:
No Answer is Posted For this Question
Be the First to Post Answer
What is the use of the tee command?
Why is shebang used?
What happens when we execute a unix command?
How do you change file permissions and ownership in Unix?
What is command statement?
In UNIX, what is the command to edit contents of the file?
Give Command that will change the name of a directly from paypal to eBay
In Unix file permissions what does the second field denotes?
What is the functions of zambie process?
Why is it called grep?
What is the Unix file system hierarchy?
What Command is used to make a directory?