fork
An unusual feature of UNIX is that it gives the user the capability of executing one program from another program using the fork command. This command gives the second program all the attributes of the first program, such as any open files, and saves the first program in its original form.
The system call fork splits a program into two copies, which are both running from the statement after the fork command. When fork is executed, a “process id” (called pid for short) is generated for the new process. This is done in a way that ensures that each process has its own unique ID number. Figure 13.4 shows what happens after the fork. The original process (Process 1) is called the parent process and the resulting process (Process 2) is the child process. A child inherits the parent’s open files and runs asynchronously with it unless the parent has been instructed to wait for the termination of the child process.