#include #include #include #define SLEEP 4 int main(int argc, char * argv[] ) { pid_t child; printf("parent process id is: %d\n",getpid()); if( (child = fork()) == 0 ) { int counter = 1; printf("child: in child, my process id is %d\n",getpid()); printf("child: my child variable is %d\n",child); while(counter < 10 ){ printf("child: counter: %d \t\t Sleeping for %d ... \n",counter,SLEEP); sleep(SLEEP); counter++; } return 0; } else { printf("parent: still in parent, my process id is still %d\n",getpid()); printf("parent: and my child is %d\n",child); return 0; } }