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

How to get the operating system's information in unix?

6 Answers   IBM, TCS,


What does this command do? Cat food 1 > kitty

0 Answers  


what is the use of the hidden files?

3 Answers  


How to know a process is a zombie or orphan process?

3 Answers   Perot Systems,


what is the command to list all files in a directory, including the hidden files in UNIX ?

9 Answers   CTS,






what is ls -ltd?

5 Answers   HCL,


what are wild cards?

2 Answers  


Explain command to display different lines that are found when compare two files?

0 Answers  


how to delete entire records in unix ?

13 Answers   Cap Gemini,


What are grep patterns?

0 Answers  


what is mount ,tell me about mount ,how can u use in real time project??

12 Answers   Symphony,


How do you remove a crontab file?

6 Answers  


Categories