← 🧱 Memory Management
Subtopic 5 of 6

5.5TLB and effective access time

The idea

The TLB caches recent translations so most accesses avoid the page-table walk. Its effect is captured by the effective access time.

Think of it like this: Keeping the phone numbers you call often on a sticky note instead of looking in the directory each time.

Why it exists

Without a TLB every memory access costs an extra access to the page table. With a good hit ratio the cost almost vanishes.

How it works

  1. Always probe the TLB: cost t.
  2. Hit: then one memory access m: total t + m.
  3. Miss: read the page table (k levels, k × m), then access memory (m): t + (k + 1)m.
  4. EMAT = h·(t + m) + (1 − h)·(t + (k + 1)m).

Worked example: t = 10 ns, m = 100 ns, h = 0.9, one-level table

Hit path 110 ns, miss path 10 + 200 = 210 ns. EMAT = 0.9 × 110 + 0.1 × 210 = 99 + 21 = 120 ns.

Now play with it

  • →Use the calculator, set levels to 2 and see the miss path grow.
  • →Set h = 0 and compare with "without a TLB".
Hit path = t + m110
Miss path = t + (k + 1)m210
EMAT120
Without a TLB200
Speed-up from the TLB1.667

Some books overlap the TLB lookup with the memory access or ignore it on a miss: follow the formula the question states. This is the standard one: the TLB is always probed first.

Check yourself

With TLB lookup 20 ns, memory 100 ns, hit ratio 0.8 and a one-level page table, EMAT is

Remember: EMAT = h(t + m) + (1 − h)(t + (k + 1)m). The TLB is always probed first.
Exam notes (the dense version)

The TLB is a small associative cache of recent page-table entries. On a hit the translation costs one TLB lookup; on a miss the page table (in memory) must be walked. For a one-level table: EMAT = h(t + m) + (1 − h)(t + m + m), i.e. a miss costs one extra memory access to fetch the PTE. With k page-table levels a miss costs k extra accesses. Context switches flush the TLB unless it has address-space ids.

Previous year questions: Memory Management (11)

PYQs are grouped by topic, so this is the full set for Memory Management; try the ones that match this subtopic. Open all 11 on the topic page.