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

Post New Answer

More Unix Commands Interview Questions

what is the difference between SED and GREP ? Which one is more better and why?

4 Answers   IBM,


What is awk command used for?

0 Answers  


what are the different operating systems available?

3 Answers  


How to get a particular string as your prompt ? Give syntax of that command?

3 Answers  


What do know about tee command and its usage?

0 Answers  


Can you write a command to erase all files in the current directory including all its sub-directories?

1 Answers  


boot process?

2 Answers   Atos Origin, Wipro,


describe the escaping sequence characteres in unix

1 Answers  


what are the different commands used to create files?

5 Answers  


when we installing aix os the ssh installed default?

2 Answers  


what is virtual machine?

2 Answers   Infosys,


What is pipe command in unix?

0 Answers  


Categories