1.1Process, PCB and process states
The idea
A process is a program in execution. The OS tracks each one in a process control block (PCB) and moves it between states as it runs, waits and finishes.
Think of it like this: A cook with several orders: one dish on the stove (running), others waiting for the pan (ready), and one waiting for the oven timer (waiting).
Why it exists
The CPU is much faster than I/O, so the OS needs a clear record of who can run, who is waiting for what, and what to restore when a process gets the CPU back.
How it works
- New: the process is being created. Admitted, it becomes Ready.
- The scheduler dispatches a Ready process: it is Running.
- Running → Ready on a timer interrupt; Running → Waiting on I/O or an event; Running → Terminated on exit.
- When the I/O finishes the process goes Waiting → Ready (not straight to Running).
Worked example: Can a Waiting process move to Running?
No. When its I/O completes it becomes Ready and must wait for the scheduler. The transitions Ready → Waiting and Waiting → Running do not exist.
Now play with it
- →Click through the diagram and see that Running has three exits.
- →Try to find a button that goes from Waiting to Running: there is none.
New
Only the allowed transitions are offered. A waiting process can never go straight to Running: it must become Ready and be dispatched again. Only one process is Running per CPU.
| PCB field | What it stores |
|---|---|
| Process state | new, ready, running, waiting, terminated |
| Program counter and registers | saved on a context switch, restored on dispatch |
| Scheduling information | priority, queue pointers, time used |
| Memory-management information | page table pointer, base and limit |
| Accounting and I/O status | CPU time used, open files, devices held |
| Process id and parent id | identity and the process tree |
Check yourself
Which transition is NOT possible in the five-state model?
Exam notes (the dense version)
A process is a program in execution: code, data, heap, stack and CPU state. The OS keeps a process control block (PCB) per process: state, program counter, registers, scheduling info, memory info, open files. States: New → Ready → Running, then Running → Waiting (I/O or event), Running → Ready (time slice over or preempted), Running → Terminated. A Waiting process goes back to Ready, never directly to Running.
Previous year questions: Processes, Threads & System Calls (15)
PYQs are grouped by topic, so this is the full set for Processes, Threads & System Calls; try the ones that match this subtopic. Open all 15 on the topic page.