Part 1 of 6 · 1 min read
Why this page comes second
In this module you will
- Name the five states of a process and draw the arrows between them.
- Say which event causes each change of state.
- List what the kernel stores in a process control block.
- Read the state of a live process with
psand/proc/PID/status. - Tell a voluntary context switch from a forced one.
Page 1 defined a process and its memory. A process does not run all the time, though. With many processes and few processors, each one waits for turns, and some also wait for a disk or a key press. This page names the situations a process can be in and the record the kernel keeps to remember one. Page 5 uses that record to switch between processes. Level 3 of this subject, on scheduling, decides which waiting process runs next. The main sources are "Operating System Concepts" (OSC), chapter 3, "Modern Operating Systems" (MOS), chapter 2, and "The Linux Programming Interface" (TLPI).
About this example About this example
Real: The C programs, commands and outputs on this page were compiled with gcc -Wall -Wextra -pthread and run on a Linux test machine (2 processors, kernel 6.18, glibc 2.39).
Scripted: The worked traces use small numbers chosen so they can be followed by hand.
Not real: The page simplifies real systems. Actual kernels add more cases, limits and tuning than a short page can show.