cis-lclient06:~/class/nov22>more exec1.c #include #include int main(void) { int pid; pid = fork(); if (pid == 0) { printf("I am the child with pid %d saying goodby\n", getpid()); return; printf("The child will never get here\n"); } printf("I am the parent (pid %d) waiting for my child (pid = %d) to die\n", getpid(), pid); wait(); printf("I am the parent (pid %d) and my child (pid = %d) has died\n", getpid(), pid); return; } cis-lclient06:~/class/nov22>gcc exec1.c cis-lclient06:~/class/nov22>./a.out I am the parent (pid 15693) waiting for my child (pid = 15694) to die I am the child with pid 15694 saying goodby I am the parent (pid 15693) and my child (pid = 15694) has died cis-lclient06:~/class/nov22>man 2 fork NAME fork - create a child process SYNOPSIS #include pid_t fork(void); DESCRIPTION fork() creates a new process by duplicating the calling process. The new process, referred to as the child, is an exact duplicate of the calling process, referred to as the parent, except for the following points: * The child has its own unique process ID, and this PID does not match the ID of any existing process group (setpgid(2)). * The childās parent process ID is the same as the parentās process ID. q cis-lclient06:~/class/nov22>