← 🧵 Processes, Threads & System Calls
Subtopic 1 of 4

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

  1. New: the process is being created. Admitted, it becomes Ready.
  2. The scheduler dispatches a Ready process: it is Running.
  3. Running → Ready on a timer interrupt; Running → Waiting on I/O or an event; Running → Terminated on exit.
  4. 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.
NewReadyRunningWaitingTerminated

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 fieldWhat it stores
Process statenew, ready, running, waiting, terminated
Program counter and registerssaved on a context switch, restored on dispatch
Scheduling informationpriority, queue pointers, time used
Memory-management informationpage table pointer, base and limit
Accounting and I/O statusCPU time used, open files, devices held
Process id and parent ididentity and the process tree

Check yourself

Which transition is NOT possible in the five-state model?

Remember: Waiting → Ready, never Waiting → Running. The PCB holds everything needed to resume.
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.