CS 208 s20 — 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:03)
  2. going over lab 5 writeup (0:47)
  3. going over lab 5 starter code (16:11)
  4. explicit free list coalescing (26:21)
  5. virtual memory intro (30:51)
  6. virtual memory: four problems (34:44)
  7. conclusion (41:13)

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=d4e95261-40d9-4d1d-b9ae-abca012946b0

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

5 Homework

  1. The week 8 quiz is due 9pm Wednesday, June 3
  2. DO NOT LEAVE LAB 5 UNTIL THE LAST MINUTE!! This is a large and complex lab. Give yourself time to work through the preparatory exercises and think carefully about the concepts involved.