A shell program reads a command with 0 or more arguments and creates a child process to execute the command.
The default is for the shell to wait for the command execution to finish; that is, to wait for the child process to terminate.
However, in Linux if the command line ends with &, the shell doesn't wait. The shell prints a prompt and handles another command while the first command executes in the background.
In this latter case, the shell has the responsibility to let the operating system know that all the information about the child can finally be discarded. Otherwise, the operating system keeps the following information:
- How the child terminated - normally or otherwise
- The child's exit or return value if it terminated normally
- The signal that caused the child to terminate if it terminated abnormally.
This information is retained in the operating system's process table entry for the child.
Freeing this entry and discarding the child information is called reaping the process.