Resource Management (HL): Scheduling, Memory and Deadlock
What the exam tests
Resource management tests how an operating system allocates CPU time, memory, storage and devices. HL questions cover process states, scheduling, virtual memory, interrupts and deadlock.
Core rules
- A process is a program in execution; it moves through states such as ready, running and blocked.
- Scheduling policies: first come first served (simple, convoy effect), shortest job first (optimal average wait but needs burst estimates and can starve long jobs), round robin (fair, quantum-dependent), priority (risk of starvation; use aging).
- Virtual memory maps logical addresses to physical frames via page tables; paging avoids external fragmentation but can cause page faults and thrashing.
- Deadlock needs four conditions: mutual exclusion, hold and wait, no preemption, circular wait. Break one to prevent it.
- Interrupts let devices signal the CPU; the OS saves context and runs an interrupt handler.
Worked example
Three processes with CPU bursts P1=8, P2=4, P3=2 arrive together. FCFS waiting times: P1=0, P2=8, P3=12; average = 20/3 โ 6.67. SJF order P3, P2, P1: waits 0, 2, 6; average = 8/3 โ 2.67. Reasoning: SJF minimizes average waiting time for a known batch, but in an interactive system it can starve P1; round robin would improve response time.
Traps
Saying virtual memory is extra RAM; confusing paging with segmentation; listing deadlock conditions without explaining prevention; ignoring starvation under priority scheduling; assuming a smaller round-robin quantum is always better.