Memory Management

Zarządzanie Pamięcią #

Scope #

  • Virtual memory - fundamentals:
    • Motivation: smaller memory allocation ⇒ better utilization, higher degree of multi-programming, smaller I/O -related overhead; virtual address space can be much larger than physical and sparse
    • Implementations: demand paging, demand segmentation
    • Memory management unit (MMU)
  • Demand paging:
    • valid-invalid bid, page fault, page swapping
    • lazy swapping, pager
    • memory reference locality and page fault frequency
    • CPU instruction restart
    • average performance of demand paging, average memory access time
    • page/frame replacement algorithms: FIFO, OPT, LRU and approximations; Belady effect
    • page buffering and raw disk mode
    • allocation of frames to a process: equal/proportional/priority, local/global; NUMA, CPU affinityS.
    • thrashing: causes, symptoms, remedies; working-set mode, page-fault frequency, middle-term scheduler.
  • Measures to improve the use of memory access:
    • memory-mapped files; memory-mapped I/O devices
    • copy-on-write(COW) and efficiency of fork()
    • allocating kernel memory; buddy algorithm, slab algorithm
    • locality of memory references and efficiency of large data structures processing
  • Examples of VM implementations: Windows, Unix, Linux

Reference #

  1. Lecture Slides
  2. Code samples
  3. Textbook:
    • chapter 8 - “Memory-management strategies”.
    • chapter 9 - “Virtual-Memory Management”,
  4. Slides: VM_en.pdf
  5. Auxiliary reading (for those interested): Linux MM Documentation, Understanding the Linux Virtual Memory Manager