Skip to main content

Command Palette

Search for a command to run...

TLB - Translation Lookaside Buffer

Published
2 min read
TLB - Translation Lookaside Buffer

Introduction

A TLB (Translation Lookaside Buffer) is a hardware cache in a computer's memory-management unit (MMU) that speeds up virtual-to-physical address translation by storing recent mappings from the slower page table. When the CPU needs to access memory, it first checks the TLB for a matching translation. A "TLB hit" provides a fast access, while a "TLB miss" requires a slower lookup in the page table, ultimately improving performance by reducing the need to access main memory twice for address translation.

How it Works

1. CPU Request:

When the CPU wants to access a memory location, it sends a virtual address to the MMU.

2. TLB Check:

The MMU first checks the TLB for a translation of this virtual address to its corresponding physical address.

3. TLB Hit:

If the translation is found in the TLB (a "hit"), the physical address is returned to the CPU immediately, resulting in a fast memory access.

4. TLB Miss:

If the translation is not in the TLB (a "miss"), the MMU must access the slower page table in main memory to find the physical address.

5. TLB Update:

The correct translation from the page table is then added to the TLB, preparing it for future use.

Key Components and Purpose

  • Cache for Page Table:

    The TLB acts as a cache for the page table, which stores virtual-to-physical memory mappings.

  • Fast Address Translation:

    By storing recent translations, the TLB avoids the need to consult the full page table on every memory access, significantly reducing latency.

  • Memory Management Unit (MMU):

    The TLB is a component of the MMU, the hardware responsible for managing virtual memory addresses.

  • Entries:

    Each TLB entry contains a virtual address, its corresponding physical address, and other memory properties like access permissions.

Pros of Using TLB

  • Faster Address Translation: Reduces the need for repeated page table accesses.
  • Better Performance: Reduces average memory access time dramatically.
  • Efficient Memory Utilization: Only the most frequently used PTEs are cached in the small, fast TLB.
  • Scalability: Especially useful for large address spaces in 64-bit architectures.

More from this blog

Cloud Tuned

627 posts

Your starting point for anything cloud: AWS, Azure, GCP, Serverless, Architecture, Hybrid Cloud, Systems Design and other Information Technology topics.