PROGRAM
#include<unistd .h="">void main() { int pid; pid= fork(); if(pid==0) { sleep(1); printf(“ child 1 is running \n Child 1 ID : %d \t Parent ID : %d”, getpid(),getppid()); close(getpid()); } else { pid= fork(); if(pid==0) { sleep(2); printf(“ Child 2 is running \n Child 2 ID : %d \t Parent ID : %d”, getpid(),getppid()); close(getpid()); } else { pid= fork(); if(pid==0) { sleep(3); printf(“ Child 3 is running \n Child 3 ID : %d \t Parent ID : %d”, getpid(),getppid()); close(getpid()); } else { sleep(3); } } } }
description and output will be published................
0 Comments:
Post a Comment