Caches and virtual memory

The memory hierarchy and locality, how a cache finds and replaces blocks, and how virtual memory translates addresses with page tables and a TLB.

About 3 hours of study

Learning objectives

Lessons

  1. 1

    The memory hierarchy Intermediate

    Why computers have registers, caches, main memory and disks: speed against size, locality, and the average memory access time.

  2. 2

    Cache memory Intermediate

    How a cache finds data: blocks, direct-mapped and set-associative placement, the tag, index and offset bits of an address, replacement and write policies.

  3. 3

    Virtual memory, page tables and the TLB Intermediate

    How every program gets its own address space: pages and frames, page tables that translate addresses, page faults, and the TLB cache that makes translation fast.

Module practice

Module quiz

1. Which of these memories is the largest?
2. With 4 KB pages, how many offset bits does a virtual address have?
3. Hit time 2 ns, miss rate 5% and miss penalty 60 ns give an AMAT of…
4. A cache has 8 sets and 32-byte blocks. How many bits do the index and offset use together?
5. A direct-mapped cache has 4 lines of 1 byte. Addresses 0, 4, 0, 4 are read. How many hits?
6. A TLB with 2 entries uses LRU. Pages 1, 2, 1, 3, 1 are accessed. How many TLB hits?

‹ The datapath and the pipelineDevices, interrupts and parallel hardware ›