The cost of address translation

Tomasz Jurkiewicz, Kurt Mehlhorn

This paper, "On a Model of Virtual Address Translation," by Tomasz Jurkiewicz and Kurt Mehlhorn, bridges a long-standing gap between theoretical algorithm analysis and the messy reality of modern hardware performance.

TL;DR

The authors propose the VAT (Virtual Address Translation) model, a new theoretical framework that accounts for the hidden costs of translating virtual memory addresses to physical ones. By modeling this translation as a multi-level tree walk that can trigger cache misses, they explain why classic algorithms like binary search and random scans perform significantly slower in practice than standard RAM models predict.

What Problem Does This Paper Address?

For decades, computer scientists have relied on the Random Access Machine (RAM) model, which assumes that any memory access takes constant time. While the External Memory (EM) model improved on this by accounting for data transfers between disk and RAM, both models ignore a critical bottleneck in 64-bit systems: Virtual Address Translation.

In modern systems, every time a program accesses a memory address, the hardware must translate a "virtual" address into a "physical" one. This isn't a single step; it’s a hardware-supported walk through a multi-level "page table" (essentially a prefix tree). If the nodes of this tree aren't in the cache, the system suffers a "translation fault." The authors noticed that for algorithms with poor locality—like random scans or binary searches—actual running times grow much faster than $O(n)$ or $O(n \log n)$. This paper provides the mathematical tools to analyze and predict these overheads.

Methods

The authors introduce the VAT model, which extends the EM model by explicitly counting cache faults incurred during the translation process.

  • The Translation Tree: They model the page table as a $K$-ary tree of height $d$. Every memory access requires traversing a path from the root to a leaf.
  • Translation Cache (TC) Analysis: They treat the Translation Lookaside Buffer (TLB) as a specialized cache and investigate replacement strategies.
  • ISP (Initial Segment Property): They define a property where a cache always contains a connected subgraph of the translation tree starting from the root.
  • New Strategies: They introduce ISLRU (Initial Segment preserving LRU) and ISMIN (the optimal offline strategy under ISP) and prove that ISMIN is optimal among ISP-compliant strategies.
  • Cache-Oblivious Mapping: They provide a theorem that bounds the VAT-complexity of cache-oblivious algorithms based on their standard EM-complexity.

Datasets

The paper evaluates its model through experimental measurements on a physical machine rather than a static dataset:

  • Hardware: Intel Xeon X5690 (3.46 GHz) with a three-level cache hierarchy (L1, L2, L3) and 12MiB Smart Cache.
  • Benchmarks: Seven fundamental programs: permute, random scan, n binary searches, heapify, heapsort, quicksort, and sequential scan.
  • Evaluation: They measured "normalized operation time" (running time divided by RAM complexity) across input sizes ranging from $2^9$ to $2^{31}$ elements.

Key Insights and Ideas

  • Translation is not Atomic: In 64-bit systems, address translation is a four-level tree walk. Treating it as a single, constant-time operation is a theoretical oversimplification that leads to incorrect performance predictions.
  • Locality Matters for Translation: Just as data access benefits from locality, the translation of those addresses also benefits. Sequential access reuses translation paths, while random access forces a full tree walk for almost every operation.
  • The "Bumpy" Reality: Experimental plots of performance aren't flat; they show distinct "bumps" that correspond exactly to the sizes of different cache levels (L1, L2, L3).
  • Cache-Oblivious Algorithms are Robust: Most cache-oblivious algorithms (like Funnel sort) naturally minimize translation overhead because they are designed to be efficient across all memory scales.

Key Results

  • Predictive Accuracy: The VAT model successfully predicts that random scan time grows as $\Theta(n \log n)$ and binary search as $\Theta(n \log^2 n)$ on modern systems, matching experimental data where the RAM model fails.
  • Optimal Caching: The authors prove that an optimal replacement strategy for the translation cache is at most twice as good as LRU on a cache of double size, extending a classic result from Sleator and Tarjan to the VAT context.
  • Huge Pages Benefit: Experiments with 2MiB "huge pages" (which reduce the translation tree height) showed significant speedups for random-access patterns, confirming that translation overhead is the primary culprit for the observed slowdowns.

Limitations and Future Work

  • Bumpy Graphs: While the VAT model explains general growth rates, the authors leave the exact "bumpy" shape of the performance graphs for permute and random scan as an open problem.
  • Tall-Cache Assumptions: Some cache-oblivious algorithms require a more stringent "tall-cache" assumption in the VAT model than in the EM model. Determining if this is strictly necessary for all such algorithms is a future research direction.
  • Curriculum Shift: The authors conclude that algorithm engineering courses should move beyond the simple RAM model to include EM and VAT models to better reflect the realities of modern hardware.

Summary updated

BibTeX
@inproceedings{jurkiewicz2013cost,
  author = {Tomasz Jurkiewicz and Kurt Mehlhorn},
  title = {{The cost of address translation}},
  booktitle = {ALENEX},
  year = {2013},
  doi = {10.1137/1.9781611972931.13},
}
Figure