#include"myHeader.h" main() { if(fork()) { printf("in parent process...\n"); printf("process id:%d\n",getpid()); } else { printf("in child process...\n"); printf("child process id:%d\n",getpid()); } }OutPut:
madan@madan-Lenovo-G570:~/madan/osconcepts$ cc ex12.c madan@madan-Lenovo-G570:~/madan/osconcepts$ ./a.out in parent process... process id:3891 in child process... child process id:3892