Create Child Process Using Fork() And What Will Be The Parent ID Of Child Process If Parent Process Terminates Before Child Process?
C Program To Create Child Process Using fork () System Call. What will be The parent ID of child process if parent process terminates before child process? Source Code: #include<stdio.h> #include<stdlib.h> #include<time.h> void main() { int pid,status; pid=fork(); if(pid==0) { sleep(10); printf("\nParent id: %d Child Process: %d",getppid(),getpid()); } else { printf("\nParent Process %d terminted...",getpid()); exit(0); } }
Tags:
OS Related C progeams
0 comments