The Runtime Theory

Process Lifecycle

Process lifecycle states: fork, ready, running, preempted, blocked, zombie, and reaping via wait.

The Runtime Theory Team09 stages

trace / request.md

CREATED VIA FORKREADY: WAITINGFOR CPURUNNING ON A CPUPREEMPTEDBLOCKED ON I/OWOKEN BYCOMPLETIONEXITINGZOMBIEREAPED BY PARENT

readyA new process is a copy of its parent: task_struct cloned, page tables duplicated with pages shared copy-on-write. The child enters the ready queue immediately.

A process is a state machine, and every transition is driven by the scheduler, a syscall, or an interrupt. This diagram maps the full lifecycle: fork creates a copy that enters the ready queue, the scheduler moves it to running, a timer preemption sends it back, a blocking read() puts it to sleep, I/O completion wakes it, and exit() starts the teardown. The last two states are the ones most people miss: the process becomes a zombie holding only its exit status until the parent calls wait(), and only then is it truly reaped. The ordering matters because each transition has a different cost profile — blocking on I/O is far cheaper than being preempted at a bad moment. The done state: the task_struct is freed and the PID returns to the pool.