Splitting the address
With page size 2n, the low n bits are the offset and the rest form the virtual page number (VPN). No arithmetic is required in hardware, only wiring.
VPN = ⌊VA / S⌋ · offset = VA mod S07Step 7 of 9 · Learn
Concise field notes, a viva drill with model answers, where this knowledge is used, and how each idea maps to real CPUs and operating systems.
With page size 2n, the low n bits are the offset and the rest form the virtual page number (VPN). No arithmetic is required in hardware, only wiring.
VPN = ⌊VA / S⌋ · offset = VA mod SA tiny associative memory keyed by (ASID, VPN). On a hit the frame number arrives in about a cycle; the page table is never touched.
hit → PA = PFN · S + offsetLow VPN bits select a set and the remaining bits are the tag. Direct-mapped TLBs are cheap but suffer conflict misses, which the bit view colours in amber.
sets = entries ÷ ways · index = log₂ setsOn a miss, a k-level page table costs k memory reads before the data read. This is why huge VA spaces depend so heavily on TLB reach.
miss = t + k·m + mA non-present PTE traps to the OS. Under demand paging it picks a victim frame, writes it back if dirty, and invalidates the victim's stale TLB entry (a shootdown).
EAT += p · SWithout ASIDs, every switch must flush the TLB. With ASID tags, entries from several processes coexist and survive the switch.
match = (ASID, VPN)Impact
Address translation happens billions of times a second inside every CPU, yet it is invisible. TLB/Scope makes it visible, measurable and testable. These are the people it helps, and how.
Check hand calculations of VPN, offset, physical address and EAT in seconds. Typical university and GATE-style questions are solved step by step in the Calculation player, so you learn the method, not just the answer.
One-click scenarios (Belady's anomaly, thrashing, context switches, demand paging) project well on a screen. Rewind the timeline and ask “what if the TLB were bigger?”, and the whole run replays live.
The built-in self-test runs 96 automated checks in front of the examiner, including textbook results such as Belady's 9 → 10 misses and EAT = 130 ns. Export the log as CSV/JSON or print a PDF report.
CPU architects must choose TLB size, associativity and replacement policy under tight area and power budgets. The Policy lab plots hit ratio against size for six policies on the same trace, which is the kind of curve used to justify those choices.
Shows why programs with poor locality run slowly: each TLB miss costs a k-level page walk. The time ledger and EAT bars make the cost concrete, which is the reasoning behind techniques such as huge pages and cache-friendly data layouts.
Explore what kernels actually manage: ASID tags vs flushing on a context switch, TLB shootdowns after a mapping changes, write protection and dirty-page write-back. Flushing on every switch is the same cost trade-off kernels weigh when they isolate address spaces for security.
The hardware path (split → TLB → walk → fault → PA) is drawn bit by bit and stage by stage, instead of being memorised as a diagram.
Change one parameter and the same timeline replays, so cause and effect is immediate and honest.
Every number is computed by a tested engine, and the Calculation player shows the working behind it.
CSV, JSON and print-ready PDF output, plus links that reproduce the exact session for a teacher or teammate.
| In TLB/Scope | In real hardware / OS | Why it matters |
|---|---|---|
| TLB (entries, ways, policy) | Per-core L1 data/instruction TLBs plus a larger shared L2 TLB in modern x86 and ARM CPUs | Most translations are served here in about a cycle |
| k-level page table | x86-64 uses 4 levels (5 with LA57); RISC-V Sv39/Sv48; ARMv8 up to 4 | Every miss costs up to k extra memory reads |
| ASID mode | x86 PCID, ARM ASID, RISC-V ASID | Avoids flushing the TLB on every context switch |
| INVLPG / shootdown | x86 invlpg, ARM TLBI, cross-core shootdown IPIs | Keeps cached translations coherent after a mapping changes |
| Demand paging + CLOCK | OS page-fault handler; Linux reclaims pages with LRU-approximating lists | Lets programs use more memory than is physically free |
| Protection & dirty bits | PTE R/W, NX, Dirty and Accessed bits | Enables copy-on-write, read-only code and efficient write-back |