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

Topic 5 · Resource Management (HL)

29 key results accumulated across 3 chapters.

OS
Ch 1
Manages hardware/software resources. The referee between apps and hardware.
Program vs Process
Ch 1
Program = file on disk. Process = running instance with its own memory, state, and PID.
5 process states
Ch 1
NEWREADYRUNNING → (BLOCKED ↔ READY) → TERMINATED.
BLOCKED
Ch 1
Process waiting for I/O. OS runs something else meanwhile — that's why I/O doesn't waste CPU.
Context switch
Ch 1
Save current state to PCB + load next process's state. Costs microseconds + pollutes caches.
FCFS
Ch 1
First-Come-First-Served. Simple. Convoy effect: one long job blocks shorter ones behind it.
SJF
Ch 1
Shortest Job First. Optimal AVERAGE wait. Risk: long jobs STARVE; OS may not know job lengths.
Round-Robin
Ch 1
Fixed time slice (e.g. 10 ms) per process; rotate. Best for INTERACTIVE systems (laptops, phones).
Priority
Ch 1
Highest priority runs. Best for REAL-TIME deadlines. Risk: low-priority STARVATION (fix: aging).
Multilevel feedback
Ch 1
Real OSes combine RR + priority + aging. Linux, Windows, macOS all do this.
Time slice trade-off
Ch 1
Shorter slice = more responsive but more context-switch overhead. Bigger = vice versa.
Virtual memory
Ch 2
Each process gets its OWN linear address space; OS+MMU translate to physical RAM.
3 benefits
Ch 2
Isolation (security + stability) + Abstraction (programmer simplicity) + Capacity (run more than fits in RAM).
Page
Ch 2
Fixed-size chunk, typically 4 KB. Unit of virtual→physical mapping.
Frame
Ch 2
A page-sized slot in physical RAM. Page tables map pages → frames.
Page table
Ch 2
Per-process table mapping each virtual page number to a physical frame (or 'on disk').
MMU
Ch 2
Memory Management Unit — hardware on the CPU that performs page-table lookups on every memory access.
TLB
Ch 2
Translation Lookaside Buffer — small cache of recent page-table lookups for speed.
Page fault
Ch 2
Page not in RAM → interrupt → OS fetches from disk (~10 ms) → retry. 100,000× slower than RAM (~100 ns).
Thrashing
Ch 2
Working set > RAM → constant page faults → CPU idle + disk 100% → system unusable. Fix: free RAM.
Isolation enforcement
Ch 2
Hardware-enforced via MMU + page tables. Process A simply CAN'T address Process B's pages. Segfault on violation.
Polling
Ch 3
CPU repeatedly asks 'are you ready?'. Simple. Wastes cycles for sparse events.
Interrupt
Ch 3
Device signals CPU; CPU pauses, runs ISR, resumes. Efficient for sparse / unpredictable events.
ISR
Ch 3
Interrupt Service Routine — SHORT OS handler that acknowledges + moves data + wakes blocked process + returns.
IVT
Ch 3
Interrupt Vector Table — maps interrupt number to ISR address.
When to poll
Ch 3
Very high-rate predictable streams (10+ Gbps networking via NAPI). OR hardware with no interrupt support.
When to interrupt
Ch 3
Sparse + unpredictable (keyboard, mouse, disk-read complete, network packet arrival).
Top half / bottom half
Ch 3
Linux convention: ISR does minimum (top); awakened kernel thread does heavy work (bottom).
ISR rule
Ch 3
Keep SHORT. Long ISRs delay other interrupts, can cause drops + unresponsive system.