Processes are the primitive units for allocation of system resources. Each process has its own address space and (usually) one thread of control. A process executes a program; you can have multiple processes executing the same program, but each process has its own copy of the program within its own address space and executes it independently of the other copies.
Processes are organized hierarchically. Each process has a parent process which explicitly arranged to create it. The processes created by a given parent are called its child processes. A child inherits many of its attributes from the parent process.
This chapter describes how a program can create, terminate, and control child processes. Actually, there are three distinct operations involved: creating a new child process, causing the new process to execute a program, and coordinating the completion of the child process with the original program.
system function provides a simple, portable mechanism for
running another program; it does all three steps automatically. If you
need more control over the details of how this is done, you can use the
primitive functions to do each step individually instead.
|• Running a Command:||The easy way to run another program.|
|• Process Creation Concepts:||An overview of the hard way to do it.|
|• Process Identification:||How to get the process ID of a process.|
|• Creating a Process:||How to fork a child process.|
|• Executing a File:||How to make a process execute another program.|
|• Process Completion:||How to tell when a child process has completed.|
|• Process Completion Status:||How to interpret the status value returned from a child process.|
|• BSD Wait Functions:||More functions, for backward compatibility.|
|• Process Creation Example:||A complete example program.|