When you run a program on your UNIX system, the system prepares a special environment for that program. This environment owns everything needed for the system to execute the program as if no other process were running on the system. Each and every process has process context, which is everything that is simple about the state of the program you are currently running. Every time you run a program the UNIX system does a fork, which acts a series of operations to make a process context and then execute your program in that context. The steps add the following:
- Locate a slot in the process table, a list of currently running process kept by UNIX.
- Give a unique process identifier (PID) to the program.
- Copy the text of the process, the parent that requested the spawning of the new program.
- Give the new PID to the parent process. This active the parent process to control or examine the process directly.
- After the fork is complete, UNIX executes your program.