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 s and g in sed command?
how will u execute a file in unix
What do chmod, chown, chgrp commands do?
How does shebang work?
What is the different between UNIX command and UNIX shell script?
What's a command word?
hw will u use awk in replacing cahrs and files
Which unix command to make a new directory?
Explain the steps that a shell follows while processing a command.
What command is used to switching between users in unix?
Write a command to find all of the files which have been accessed within the last 30 days.
5 Answers Google, IBM, Satyam,
What is the use of touch command in there?