PROCESS GROUPS, SESSIONS,
AND JOB CONTROL
Process groups and sessions form a two-level hierarchical relationship between pro-
cesses: a process group is a collection of related processes, and a session is a collec-
tion of related process groups. The meaning of the term related in each case will
become clear in the course of this chapter.
Process groups and sessions are abstractions defined to support shell job con-
trol, which allows interactive users to run commands in the foreground or in the
background. The term job is often used synonymously with the term process group.
This chapter describes process groups, sessions, and job control.
34.1 Overview
A process group is a set of one or more processes sharing the same process group
identifier (PGID). A process group ID is a number of the same type (pid_t) as a pro-
cess ID. A process group has a process group leader, which is the process that creates
the group and whose process ID becomes the process group ID of the group. A
new process inherits its parent’s process group ID.
A process group has a lifetime, which is the period of time beginning when the
leader creates the group and ending when the last member process leaves the
group. A process may leave a process group either by terminating or by joining