Numerical: calculate the effective memory access time with a TLB.
HardConceptOS Numericals
Answer
Problem: TLB lookup t = 20 ns, memory access m = 100 ns and hit ratio h = 95%. Find the effective access time (EAT) with (a) a single-level and (b) a two-level page table, and (c) the hit ratio needed for EAT ≤ 122 ns in case (a). Answer: (a) 125 ns, (b) 130 ns, (c) h ≥ 98%.
- Hit: the TLB lookup plus one memory access for the data, t + m.
- Miss with a k-level page table: the TLB lookup, k accesses to walk the tables and one for the data, t + (k + 1) × m.
- EAT = h × hit time + (1 − h) × miss time. This assumes the TLB is searched first; if a question says the TLB and page table are searched in parallel, drop t from the miss time.
Example (worked solution):
(a) Hit = 20 + 100 = 120 ns; miss = 20 + 200 = 220 ns. EAT = 0.95 × 120 + 0.05 × 220 = 114 + 11 = 125 ns, 25% slower than a plain memory access.
(b) Miss = 20 + 300 = 320 ns. EAT = 0.95 × 120 + 0.05 × 320 = 114 + 16 = 130 ns.
(c) EAT = 120h + 220(1 − h) = 220 − 100h, and 220 − 100h ≤ 122 gives h ≥ 0.98. Check: 0.98 × 120 + 0.02 × 220 = 117.6 + 4.4 = 122 ns.