Course contentsShow
← Computer Science
Lesson 1363 of 2,87231. Memory ManagementFree lesson

TLB Miss Handling

Learning what happens when a virtual address translation is not found in the TLB and requires a page table walk.

TLB Miss Handling

What You'll Learn

You'll learn what happens when the Translation Lookaside Buffer (TLB) doesn't contain the virtual-to-physical address translation you need, forcing the system to perform a slower page table walk.

The Problem: When the Fast Path Fails

The TLB is a small, fast cache that stores recent virtual-to-physical address translations. But what happens when the translation you need isn't in the TLB? This is called a TLB miss, and it requires special handling.

Think of the TLB like your phone's speed dial—quick access to frequently called numbers. When you need to call someone not in your speed dial, you have to look them up in your full contacts list. That lookup takes longer.

What Happens on a TLB Miss

When a TLB miss occurs, the system must perform a page table walk:

  1. TLB lookup fails: The requested virtual address isn't found in the TLB
  2. Walk the page table: The MMU (or OS) traverses the page table structure in main memory to find the correct translation
  3. Retrieve the mapping: The page table entry (PTE) containing the physical frame number is located
  4. Update the TLB: The new translation is loaded into the TLB, possibly evicting an old entry
  5. Retry the access: The memory access completes using the newly cached translation

Hardware vs Software Handling

Some architectures handle TLB misses entirely in hardware—the MMU automatically walks the page table without OS intervention. Others use software handlers, where a TLB miss triggers an exception and the OS performs the page table walk explicitly.

The page table walk can be expensive, especially with multi-level page tables, requiring multiple memory accesses just to translate one address.

Key Takeaway: A TLB miss forces a page table walk through main memory to find the translation, which is much slower than a TLB hit but necessary to continue the memory access.