CS 208 s21 — Lab 5 Overview; Virtual Memory: Four Problems

Table of Contents

1 Video

Here is a video lecture for the material outlined below. It contains sections on

  1. introduction (0:00)
  2. going over lab 5 writeup (0:44)
  3. going over lab 5 starter code (15:52)
  4. explicit free list coalescing (26:00)
  5. virtual memory intro (30:30)
  6. virtual memory: four problems (34:22)

The Panopto viewer has table of contents entries for these sections. Link to the Panopto viewer: https://carleton.hosted.panopto.com/Panopto/Pages/Viewer.aspx?id=e0ac8e93-4221-4804-bd46-ac59010e07da

2 Lab 5 Overview

3 The Memory We've Been Working With is an Illusion

  • Programs refer to virtual memory addresses
    • movq (%rdi),%rax
    • Conceptually memory is just a very large array of bytes
    • System provides private address space to each process
  • However…
    • We probably don’t have 2w bytes of physical memory
    • We certainly don’t have 2w bytes of physical memory for every program
    • Programs should not interfere with one another
      • Except in certain cases where they want to share code or data

4 Problems We Need to Solve When it Comes to Memory:

4.1 Problem 1: How Does Everything Fit?

vm-problem1.png

4.2 Problem 2: Where Does Everything Go?

vm-problem2.png

4.3 Problem 3: How to Protect One Process From Another?

vm-problem3.png

4.4 Problem 4: How Do Processes Share Memory?

vm-problem4.png

4.5 Solution: Add a Layer of Indirection

vm-indirection.png

  • each process gets it's own virtual address space
  • each byte of physical memory has
    • one physical address (PA)
    • zero, one, or more virtual addresses (VAs)
  • VAs can map to memory, disk, or nowhere (if unused)

vm-mapping.png