CS 208 w20 lecture 22 outline

1 Last Call For Lab 5 Partners

2 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 process
    • Processes should not interfere with one another
      • Except in certain cases where they want to share code or data

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

3.1 Problem 1: How Does Everything Fit?

vm-problem1.png

3.2 Problem 2: Where Does Everything Go?

vm-problem2.png

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

vm-problem3.png

3.4 Problem 4: How Do Processes Share Memory?

vm-problem4.png

3.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