5 Virtual Memory

Week 6-8: October 3-7, 27 - November 1, 2022

  • DINOS Chapter 9
  • LOVE Chapter 15 pgs 305-308, 320-322
  • LOVE Chapter 12 - This about how the linux kernel manages its own memory, which is largely not virtualized!

5.1 A video summary

5.1.1 Why do we need to virtualize memory?

5.1.2 Paging

5.1.3 Page Replacement Algorithms & The Working Set

5.1.4 Thrashing, TLB & Other Optimizations

Learning Objectives

  • Why do we need memory virtualization? If new hardware gives us more RAM than we would ever need, would we still need virtualization?
  • Why are mapping tables restricted to simple (or multi-level) lookup tables? Why not use hash tables, where we hash the virtual address to retrieve the physical address?
  • Why do multi-level page tables occupy less space than a single-level page table?
  • Describe how memory is consumed throughout the process life-cycle from creation to loading to execution to termination.
  • A program can read a data file via malloc/read or mmap. What is the difference the two? If the OS needs to evict dirty pages from these regions, where do they go?
  • How does the MMU unit relate invalid memory access to the kernel? What flags are used on x86 32-bit addressing?
  • In early systems, there was no hardware support for setting and clearing dirty/use bits of a page. Describe how an OS can emulate the hardware support for setting and clearing dirty bits in software?
  • What is the purpose of the TLB? Why is it usually a fully-associative cache?
  • How and why is memory management for the kernel different?
  • What purpose does copy-on-write serve? Give some use-cases?