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

If we want to see first 35 lines of a file which command we have to use?

8 Answers  


What is the first character of the output in ls l command?

0 Answers  


What is the use of egrep command in unix?

0 Answers  


what is the command to find out the difference between files and folders?

6 Answers  


How to copy multiple files and directories into some other directory?

4 Answers  






Which command will print your home directory on screen?

0 Answers  


What are bash commands?

0 Answers  


solaris Run level?

3 Answers   Wipro,


Give Command that will change the name of a directly from paypal to eBay

3 Answers   Alcatel, IBM,


Give the command to display space usage on the UNIX file system.

16 Answers  


Name the general commands in using unix os for a beginner?

0 Answers  


How to create hardlinks and softlinks on files?

2 Answers  


Categories