#include"myHeader.h" main() { if(fork()) { printf("in parent...\n"); sleep(2); printf("parent is terminating...\n"); } else { printf("in child...\n"); sleep(7); while(1); printf("child is terminating...\n"); } }OutPut:
madan@madan-Lenovo-G570:~/madan/osconcepts$ cc ex14.c madan@madan-Lenovo-G570:~/madan/osconcepts$ ./a.out in parent... in child... parent is terminating...