Loading…
Loading…
Charting your lesson…
Opening your lesson…
Process States and the PCB
Lesson 2 of 4
6 steps•about 12 min•12 flashcards
Step 1/ 61 min
The OS juggles dozens of processes on a handful of CPUs by tracking, for each one, what it is doing right now (its state) and everything needed to resume it (its PCB). These two concepts underpin scheduling, context switching and every OS diagram in an exam.
Core idea: a process moves through a small set of states (new, ready, running, waiting, terminated) as it competes for the CPU and waits on I/O. The Process Control Block (PCB) is the kernel data structure that stores a process's complete context — its ID, state, registers, memory maps and more — so it can be paused and resumed transparently.
Step 2/ 61 min
admit dispatch exit
[New] ------> [Ready] ---------> [Running] ------> [Terminated]
^ <--------- |
| (timer/preempt) |
| | I/O or event wait
+---- [Waiting] <---+
(I/O complete)
Only the scheduler moves a process Ready → Running (dispatch). A running process goes:
Each process has one PCB (kernel-resident). It holds:
Step 3/ 61 min
A process is Running and executes read(file):
read.Step 4/ 61 min
Very common: "draw the process state diagram", "difference between Ready and Waiting/Blocked", "what does a PCB contain", and "which transition does the scheduler control?" (Ready → Running). GATE loves the subtle point that I/O completion sends a process to Ready, not Running.
Step 5/ 61 min
Confusing the Ready and Waiting (Blocked) states, or drawing a direct Waiting → Running arrow. A blocked process that finishes its I/O returns to the Ready queue and must be scheduled again before it runs. Ready processes only lack a CPU; waiting processes lack a resource/event entirely.
Step 6/ 6· Worked examples2 min
Problem
Trace the state transitions of a process through this timeline on a single-CPU system, naming each transition and what the OS does to the PCB:
Try it on paper first.
Recall
Keep this
Process states and the PCB are foundational OS knowledge that scheduling and context-switching build on. Expect "draw the process state diagram" and "what does the PCB store?" in written and viva rounds.
A process moves through five states:
Key transitions: Ready→Running (dispatch), Running→Ready (preemption/timeout), Running→Waiting (I/O request), Waiting→Ready (I/O complete).
The PCB is the OS data structure that stores everything about a process, used to save/restore it on a context switch:
| PCB field | Holds |
|---|---|
| PID | unique process id |
| Process state | new/ready/running/… |
| Program counter | next instruction address |
| CPU registers | saved register values |
| Scheduling info | priority, queue pointers |
| Memory info | page tables, limits |
| I/O status | open files, devices |
"Draw/label the process state diagram", "what does the PCB contain?", "which transition is preemption?", "difference between zombie and orphan", and "can a waiting process run directly?".
Five states: New, Ready, Running, Waiting, Terminated. Transitions: dispatch, preemption, I/O request/complete. The PCB stores PID, state, PC, registers, scheduling/memory/I-O info — saved and restored on context switches so a process resumes exactly. Blocked processes must return to Ready before running.
You've read 0 of 6 steps
Now lock it in — questions straight after reading are what make it stick.