This chapter covers starting and stopping processes, sending signals to running programs, viewing information on running processes, shell job control, and more. These essential functions enable the Unix user to manage multiple processes from the command prompt, as well as to understand the ongoing functions of a multiuser operating system. You'll learn how to identify and control system and user processes with basic Unix tools.
A process, in simple terms, is an instance of a running program.
As covered in Chapter 2, the parent of all processes, init, is started when the operating system boots. Historically, it is process ID number 1. As other programs are started, each is assigned a unique process identifier, known as a PID.
Behind the scenes, a fork library call or an execve system call is used to start the new program. A fork is produced when the current running program is copied to make a child, an exact copy of the running program. The forked program has a new PID and a different parent process ID (of course), and the child's resource utilizations are all reset. For example, by default, the forked child and its parent share file descriptors and can share open files.
In contrast to forking a process, you can replace the current running process with a new process. The Unix shell includes a built-in command called exec that replaces the running shell with a new program. (Behind the scenes, this uses the execve system call.) ...