cis-lclient06:~/class/nov22>more exec1.c
#include <syscall.h>
#include <stdio.h>
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 <unistd.h>

       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>