<P> If fork was successful, then there are now two processes, both executing the main function from the point where fork has returned . To make the processes perform different tasks, the program must branch on the return value of fork to determine whether it is executing as the child process or the parent process . </P> <P> In the child process, the return value appears as zero (which is an invalid process identifier). The child process prints the desired greeting message, then exits . (For technical reasons, the POSIX _exit function must be used here instead of the C standard exit function .) </P> <P> The other process, the parent, receives from fork the process identifier of the child, which is always a positive number . The parent process passes this identifier to the waitpid system call to suspend execution until the child has exited . When this has happened, the parent resumes execution and exits by means of the return statement . </P>

A process with n fork() system calls generates 2n – 1 child processes