How to use the Effective Memory Access Time (TLB) Calculator
- 1. Enter the timesType the TLB hit ratio, TLB access time and main memory access time in ns.
- 2. Pick the setupSet the number of page-table levels and whether the TLB time counts on a miss. Turn on page faults if the question has them.
- 3. Read the workingSee hit time, miss time, EAT, the slowdown and a table of EAT for other hit ratios.
The EAT formula
With paging, every memory reference first needs the frame number. The TLB holds recent page-to-frame mappings. On a hit the cost is one TLB lookup plus one memory access. On a miss the CPU also walks the page table, which costs one memory access per level.
EAT = h × (t + m) + (1 − h) × (t + (L + 1) × m), where h is the hit ratio, t the TLB time, m the memory time and L the number of page-table levels. If the TLB and the page table are searched in parallel, drop t from the miss term. With page faults, Silberschatz uses EAT = (1 − p) × EAT + p × service time.
Worked example (Silberschatz style)
TLB access 20 ns, memory access 100 ns, hit ratio 80%, single-level page table.
- Hit time = 20 + 100 = 120 ns.
- Miss time = 20 + 100 + 100 = 220 ns.
- EAT = 0.8 × 120 + 0.2 × 220 = 96 + 44 = 140 ns, a 40% slowdown.
Raise the hit ratio to 98% and EAT falls to 0.98 × 120 + 0.02 × 220 = 122 ns. With a two-level table the miss costs 20 + 3 × 100 = 320 ns, so at 80% EAT = 96 + 64 = 160 ns.
Page faults change everything
A page fault costs milliseconds, not nanoseconds. With memory access 200 ns, fault service time 8 ms and p = 0.001, EAT = 0.999 × 200 + 0.001 × 8,000,000 = 8,199.8 ns, about 8.2 µs. That is 40 times slower than memory. To keep the slowdown under 10%, p must be below 0.0000025, about one fault in 400,000 accesses. Use the target field to work out the hit ratio a question asks for.
Frequently asked questions
Should I add the TLB time on a miss?
Most books add it, because the TLB is searched first and the page table only after a miss. Some GATE questions say the searches are parallel; then choose the parallel option.
How do multi-level page tables change EAT?
Each level is one more memory access on a TLB miss. A 4-level table makes a miss cost t + 5m.
What if the question ignores the TLB time?
Enter 0 ns for the TLB access time. EAT then becomes h × m + (1 − h) × 2m for one level.
Where does a cache fit in?
Work out the cache's average access time first and enter it as the memory access time.