Virtual Memory - Concepts

Class: CSCE-312


Notes:

Today

Address spaces

A System Using Physical Addressing

Pasted image 20251118135140.png400

A System Using Virtual Addressing

Pasted image 20251118135628.png500

Address Spaces

Notes:

Why Virtual Memory (VM)?

Notes:

VM as a tool for caching

VM as a tool for caching

Pasted image 20251120131311.png500

DRAM Cache Organization

Enabling Data Structure: Page Table

Pasted image 20251120132006.png550

Page Hit

Page Fault

Handling Page Fault

Pasted image 20251120133335.png700

Allocating Pages

Pasted image 20251120133709.png500

Locality to the Rescue Again!

Notes:

VM as a tool for memory management

Virtual Address Space

Pasted image 20251120134205.png500

Notes:

Simplifying Linking and Loading

Pasted image 20251120134442.png400

VM as a tool for memory protection

Memory Protection

Address Translation

Summary of Address Translation Symbols

Address Translation With a Page Table

Pasted image 20251120135509.png700

  1. Add index to page table
  2. Read memory (1)
  3. Read memory (2)

Address Translation: Page Hit

Pasted image 20251202131728.png500

  1. Processor sends virtual address to MMU
  2. MMU fetches PTEA from page table in memory
  3. MMU fetches PTE from page table in memory
  4. MMU sends physical address to cache/memory
  5. Cache/memory sends data word to processor

Address Translation Page Fault

Usually handled in software by the OS
Pasted image 20251202131814.png600

  1. Processor sends virtual address to MMU
  2. MMU fetches PTEA from page table in memory
  3. MMU fetches PTE from page table in memory
  4. Valid bit is zero, so MMU triggers page fault exception
  5. Handler identifies victim (and, if dirty, pages it out to disk)
  6. Handler pages in new page and updates PTE in memory
  7. Handler returns to original process, restarting faulting instruction

Integrating VM and Cache

Pasted image 20251202132215.png600
VA: virtual address, PA: physical address, PTE: page table entry, PTEA = PTE address

Speeding up Translation with a TLB

Notes:

Accessing the TLB

TLB Hit

Pasted image 20251202132510.png450

TLB Miss

Pasted image 20251202132558.png450

Multi-Level Page Tables

Pasted image 20251202132920.png200

A Two-Level Page Table Hierarchy

Pasted image 20251202133045.png700

Translating with a k-level

Pasted image 20251202133223.png600

Remember: 3 Kinds of misses in caches?

Summary