Operating Systems · Revision notes
Memory Management & Virtual Memory
The OS must share main memory among processes safely and efficiently. This chapter covers contiguous allocation and fragmentation, paging with page tables and the TLB, virtual memory with demand paging, page replacement (FIFO, LRU, Optimal with Belady’s anomaly) and thrashing.
Quick revision
- Internal fragmentation (fixed/paging) vs external (variable partitions)
- Page number bits = address bits - offset bits; PA = frame × page size + offset
- EAT with TLB = h(t + m) + (1 - h)(t + 2m)
- Page fault: trap → find frame → read disk → update table → restart
- OPT ≤ LRU ≤ FIFO typically; only FIFO has Belady’s anomaly
- Thrashing: too few frames, CPU idle; fix with working set or fewer processes