Topic 5 · Resource Management (HL)
Computer Science · Cheatsheet

Topic 5 · Resource Management (HL)

Chapter 1 · OS, processes & scheduling

📋 Reference · always available
OS
Manages hardware/software resources. The referee between apps and hardware.
Program vs Process
Program = file on disk. Process = running instance with its own memory, state, and PID.
5 process states
NEWREADYRUNNING → (BLOCKED ↔ READY) → TERMINATED.
BLOCKED
Process waiting for I/O. OS runs something else meanwhile — that's why I/O doesn't waste CPU.
Context switch
Save current state to PCB + load next process's state. Costs microseconds + pollutes caches.
FCFS
First-Come-First-Served. Simple. Convoy effect: one long job blocks shorter ones behind it.
SJF
Shortest Job First. Optimal AVERAGE wait. Risk: long jobs STARVE; OS may not know job lengths.
Round-Robin
Fixed time slice (e.g. 10 ms) per process; rotate. Best for INTERACTIVE systems (laptops, phones).
Priority
Highest priority runs. Best for REAL-TIME deadlines. Risk: low-priority STARVATION (fix: aging).
Multilevel feedback
Real OSes combine RR + priority + aging. Linux, Windows, macOS all do this.
Time slice trade-off
Shorter slice = more responsive but more context-switch overhead. Bigger = vice versa.