Process Descriptor
To manage processes, the
kernel must have a clear picture of
what each process is doing. It must know, for instance, the
process’s priority, whether it is running on a CPU
or blocked on an event, what address space has been assigned to it,
which files it is allowed to address, and so on. This is the role of
the process descriptor
— a
task_struct type structure whose fields contain
all the information related to a single process. As the repository of
so much information, the process descriptor is rather complex. In
addition to a large number of fields containing process attributes,
the process descriptor contains several pointers to other data
structures that, in turn, contain pointers to other structures. Figure 3-1 describes the Linux process descriptor
schematically.

Figure 3-1. The Linux process descriptor
The five data structures on the right side of the figure refer to specific resources owned by the process. These resources are covered in future chapters. This chapter focuses on two types of fields that refer to the process state and to process parent/child relationships.
Process State
As its name implies, the state field of the process descriptor describes what is currently happening to the process. It consists of an array of flags, each of which describes a possible process state. In the current Linux version, these states are mutually exclusive, and hence ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access