Paging with Translation Lookaside Buffer (TLB) Scheme
Paging is a virtual memory technique in which a logical address is split into a page number and a page offset. The page number identifies which virtual page is being referenced, while the offset identifies the exact location within that page. In a simple paging system, the processor must consult the page table to translate the virtual page number into a physical frame number before accessing memory, which can add substantial overhead.2
A Translation Lookaside Buffer (TLB) is introduced to reduce this overhead. The TLB is a small, fast associative cache inside or near the MMU, storing recently used page-table entries. If the required translation is found in the TLB, address translation completes quickly without consulting the page table in main memory; this is called a TLB hit. If the translation is absent, a TLB miss occurs, and the hardware or operating system must walk the page table, install the translation into the TLB, and then proceed.3
Without a TLB, a one-level page table usually requires two memory references for each access: one to fetch the page-table entry and another to fetch the actual data. With a high TLB hit ratio, most references need only one main-memory access after a very small TLB lookup cost, making paging practical in modern systems.3
Footnotes
-
Translation lookaside buffer - Wikipedia - Overview of TLB purpose, hits, misses, and its role in reducing paging overhead. ↩ ↩2 ↩3
-
Translation Lookaside Buffer (TLB) in Paging - GeeksforGeeks - Stepwise explanation of TLB hit/miss flow and standard EMAT formula. ↩
-
Faster Translations (TLBs) - OSTEP PDF - Detailed academic treatment of TLBs, address translation, misses, and context-switch issues. ↩ ↩2
-
Translation Lookaside Buffer | TLB | Paging | Gate Vidyalay - Concise explanation of paging with TLB, hit/miss behavior, and update process. ↩
-
Translation Lookaside Buffer (TLB) | COMS W4118 Operating Systems I - Effective access time discussion and why high hit ratio makes paging efficient. ↩
Paging - Translation Lookaside Buffer (TLB)
Why the TLB Matters
A straightforward paging system can nearly double memory-reference cost because translation itself needs memory access. The TLB avoids most of that overhead by caching recent translations.2
Footnotes
-
Translation lookaside buffer - Wikipedia - Overview of TLB purpose, hits, misses, and its role in reducing paging overhead. ↩
-
Faster Translations (TLBs) - OSTEP PDF - Detailed academic treatment of TLBs, address translation, misses, and context-switch issues. ↩
Basic address translation in paging with TLB
A virtual address is conventionally divided into two fields:
If page size is bytes, then the lower bits form the offset and the remaining higher-order bits form the page number.2 The TLB stores mappings of the form:
Once the frame number is found, the physical address is formed as:
The offset does not change during translation because both pages and frames are the same size.2
A typical TLB entry contains the virtual page number tag, corresponding physical frame number, and control bits such as valid, protection, dirty, or access permissions. Many systems also include an ASID or process identifier so that entries from different processes can coexist safely.2
Footnotes
-
Translation Lookaside Buffer (TLB) in Paging - GeeksforGeeks - Stepwise explanation of TLB hit/miss flow and standard EMAT formula. ↩ ↩2
-
Translation Lookaside Buffer | TLB | Paging | Gate Vidyalay - Concise explanation of paging with TLB, hit/miss behavior, and update process. ↩ ↩2 ↩3
-
Lecture 18 Virtual Memory 2 - MIT PDF - Hardware-oriented notes on TLB design, ASIDs, hardware page walks, and page faults. ↩
Address Translation Procedure with TLB
- 1Step 1
The CPU issues a logical address containing a virtual page number and an offset.2
Footnotes
-
Translation Lookaside Buffer (TLB) in Paging - GeeksforGeeks - Stepwise explanation of TLB hit/miss flow and standard EMAT formula. ↩
-
Translation Lookaside Buffer | TLB | Paging | Gate Vidyalay - Concise explanation of paging with TLB, hit/miss behavior, and update process. ↩
-
- 2Step 2
The MMU checks the TLB associatively to determine whether the referenced virtual page already has a cached translation.2
Footnotes
-
Faster Translations (TLBs) - OSTEP PDF - Detailed academic treatment of TLBs, address translation, misses, and context-switch issues. ↩
-
Translation Lookaside Buffer | TLB | Paging | Gate Vidyalay - Concise explanation of paging with TLB, hit/miss behavior, and update process. ↩
-
- 3Step 3
If the mapping is present, the frame number is obtained immediately, combined with the offset, and physical memory is accessed.2
Footnotes
-
Translation Lookaside Buffer (TLB) in Paging - GeeksforGeeks - Stepwise explanation of TLB hit/miss flow and standard EMAT formula. ↩
-
Faster Translations (TLBs) - OSTEP PDF - Detailed academic treatment of TLBs, address translation, misses, and context-switch issues. ↩
-
- 4Step 4
If the mapping is absent, the MMU or operating system consults the page table in main memory through a page-table walk to find the correct frame.3
Footnotes
-
Faster Translations (TLBs) - OSTEP PDF - Detailed academic treatment of TLBs, address translation, misses, and context-switch issues. ↩
-
Translation Lookaside Buffer | TLB | Paging | Gate Vidyalay - Concise explanation of paging with TLB, hit/miss behavior, and update process. ↩
-
Lecture 18 Virtual Memory 2 - MIT PDF - Hardware-oriented notes on TLB design, ASIDs, hardware page walks, and page faults. ↩
-
- 5Step 5
After the translation is found and validated, the mapping is inserted into the TLB, often replacing an older entry according to a policy such as LRU or FIFO.2
Footnotes
-
Translation Lookaside Buffer (TLB) in Paging - GeeksforGeeks - Stepwise explanation of TLB hit/miss flow and standard EMAT formula. ↩
-
Translation Lookaside Buffer | TLB | Paging | Gate Vidyalay - Concise explanation of paging with TLB, hit/miss behavior, and update process. ↩
-
- 6Step 6
If the page-table entry is valid, memory access proceeds. If the entry indicates the page is not in memory or violates protection rules, a page fault or protection fault is raised.2
Footnotes
-
Faster Translations (TLBs) - OSTEP PDF - Detailed academic treatment of TLBs, address translation, misses, and context-switch issues. ↩
-
Lecture 18 Virtual Memory 2 - MIT PDF - Hardware-oriented notes on TLB design, ASIDs, hardware page walks, and page faults. ↩
-
TLB hit and TLB miss behavior
The TLB scheme is best understood by separating the two common cases:
| Case | What happens | Memory references involved |
|---|---|---|
| TLB hit | Translation found in TLB; frame number is used immediately | TLB lookup + 1 memory access for data |
| TLB miss | Translation absent; page table must be consulted, then TLB updated | TLB lookup + page-table access + data access |
| Page fault | Page-table lookup reveals page is not in physical memory | TLB lookup + page-table access + disk/OS handling |
On a TLB hit, the system avoids a page-table memory reference entirely. On a TLB miss, the system pays an additional penalty to fetch the page-table entry and update the TLB. If the page is not resident in physical memory, the event escalates to a page fault, which is much more expensive than a mere TLB miss because it may require disk I/O.3
This distinction is crucial: a TLB miss does not necessarily mean a page fault. A TLB miss only means the translation is not cached in the TLB; the page may still be present in memory and correctly described by the page table.2
Footnotes
-
Translation lookaside buffer - Wikipedia - Overview of TLB purpose, hits, misses, and its role in reducing paging overhead. ↩
-
Faster Translations (TLBs) - OSTEP PDF - Detailed academic treatment of TLBs, address translation, misses, and context-switch issues. ↩ ↩2
-
Lecture 18 Virtual Memory 2 - MIT PDF - Hardware-oriented notes on TLB design, ASIDs, hardware page walks, and page faults. ↩ ↩2
Do Not Confuse TLB Miss with Page Fault
A TLB miss only means the translation is not cached. A page fault means the page is not currently resident or violates validity rules. The first is a cache miss; the second is an exception requiring OS intervention.2
Footnotes
-
Faster Translations (TLBs) - OSTEP PDF - Detailed academic treatment of TLBs, address translation, misses, and context-switch issues. ↩
-
Lecture 18 Virtual Memory 2 - MIT PDF - Hardware-oriented notes on TLB design, ASIDs, hardware page walks, and page faults. ↩
Effective Memory Access Time (EMAT)
The central performance reason for using a TLB is reduction of effective memory access time. Let:
- = TLB hit ratio
- = TLB lookup time
- = main memory access time
For a one-level paging system, a common EMAT model is:
Explanation:
- On a hit, cost is
- On a miss, cost is because one memory access is needed for the page-table entry and another for the actual data3
This expression can be simplified:
assuming the same is paid in both cases.
Example
Suppose:
Then:
Without a TLB, access would require approximately in a simple one-level model. Thus, even a modestly sized TLB with high locality substantially improves performance.3
Footnotes
-
Translation Lookaside Buffer (TLB) in Paging - GeeksforGeeks - Stepwise explanation of TLB hit/miss flow and standard EMAT formula. ↩ ↩2
-
Translation Lookaside Buffer (TLB) | COMS W4118 Operating Systems I - Effective access time discussion and why high hit ratio makes paging efficient. ↩ ↩2
-
Virtual Memory and Page Tables - University of Pennsylvania PDF - Lecture notes explaining TLB locality, small associative structures, and MMU refill behavior. ↩ ↩2 ↩3
Memory Access Cost Comparison
Illustrative comparison for a one-level paging system with ns and ns.
A TLB hit occurs when the virtual page number is already cached in the TLB. The MMU obtains the frame number directly, combines it with the offset, and performs one memory access for the data.2
Footnotes
-
Translation Lookaside Buffer (TLB) in Paging - GeeksforGeeks - Stepwise explanation of TLB hit/miss flow and standard EMAT formula. ↩
-
Faster Translations (TLBs) - OSTEP PDF - Detailed academic treatment of TLBs, address translation, misses, and context-switch issues. ↩
Lifecycle of a Memory Reference in a TLB-Based Paging System
CPU issues address
Stage 1The processor produces a virtual address composed of a virtual page number and an offset.2"
Footnotes
-
Translation Lookaside Buffer (TLB) in Paging - GeeksforGeeks - Stepwise explanation of TLB hit/miss flow and standard EMAT formula. ↩
-
Translation Lookaside Buffer | TLB | Paging | Gate Vidyalay - Concise explanation of paging with TLB, hit/miss behavior, and update process. ↩
TLB lookup
Stage 2The MMU checks the TLB associatively for a cached translation.2"
Footnotes
-
Faster Translations (TLBs) - OSTEP PDF - Detailed academic treatment of TLBs, address translation, misses, and context-switch issues. ↩
-
Translation Lookaside Buffer | TLB | Paging | Gate Vidyalay - Concise explanation of paging with TLB, hit/miss behavior, and update process. ↩
Hit or miss decision
Stage 3If the translation is found, execution proceeds quickly; otherwise the page table must be consulted.2"
Footnotes
-
Translation Lookaside Buffer (TLB) in Paging - GeeksforGeeks - Stepwise explanation of TLB hit/miss flow and standard EMAT formula. ↩
-
Faster Translations (TLBs) - OSTEP PDF - Detailed academic treatment of TLBs, address translation, misses, and context-switch issues. ↩
Page-table walk
Stage 4The hardware or OS retrieves the page-table entry from memory to determine the frame number and access status.2"
Footnotes
-
Faster Translations (TLBs) - OSTEP PDF - Detailed academic treatment of TLBs, address translation, misses, and context-switch issues. ↩
-
Lecture 18 Virtual Memory 2 - MIT PDF - Hardware-oriented notes on TLB design, ASIDs, hardware page walks, and page faults. ↩
TLB refill
Stage 5A valid translation is inserted into the TLB so later accesses to the same page are faster.2"
Footnotes
-
Faster Translations (TLBs) - OSTEP PDF - Detailed academic treatment of TLBs, address translation, misses, and context-switch issues. ↩
-
Translation Lookaside Buffer | TLB | Paging | Gate Vidyalay - Concise explanation of paging with TLB, hit/miss behavior, and update process. ↩
Data access or fault handling
Stage 6The system either accesses physical memory or raises a page fault/protection exception.2"
Footnotes
-
Faster Translations (TLBs) - OSTEP PDF - Detailed academic treatment of TLBs, address translation, misses, and context-switch issues. ↩
-
Lecture 18 Virtual Memory 2 - MIT PDF - Hardware-oriented notes on TLB design, ASIDs, hardware page walks, and page faults. ↩
Suitable conceptual diagram of paging with TLB
The following diagram captures the hardware path more explicitly:
This diagram emphasizes four core observations:
- The TLB sits on the critical path of address translation.2
- A hit avoids page-table access entirely.2
- A miss causes a page-table walk and then usually a TLB refill.2
- Only if the page-table entry is invalid or nonresident does the system trigger a page fault.2
In practice, modern processors may use multi-level TLB hierarchies, multi-level page tables, and hardware page walkers. Nevertheless, the conceptual model above remains the standard explanation for paging with TLBs.3
Footnotes
-
Faster Translations (TLBs) - OSTEP PDF - Detailed academic treatment of TLBs, address translation, misses, and context-switch issues. ↩ ↩2 ↩3 ↩4
-
Translation Lookaside Buffer | TLB | Paging | Gate Vidyalay - Concise explanation of paging with TLB, hit/miss behavior, and update process. ↩ ↩2
-
Translation Lookaside Buffer (TLB) in Paging - GeeksforGeeks - Stepwise explanation of TLB hit/miss flow and standard EMAT formula. ↩
-
Translation Lookaside Buffer (TLB) | COMS W4118 Operating Systems I - Effective access time discussion and why high hit ratio makes paging efficient. ↩
-
Lecture 18 Virtual Memory 2 - MIT PDF - Hardware-oriented notes on TLB design, ASIDs, hardware page walks, and page faults. ↩ ↩2 ↩3
Advanced Notes and Common Questions
Exam-Oriented Insight
When solving numerical problems, separate the cases clearly: TLB hit, TLB miss without page fault, and page fault. Most textbook EMAT questions for paging with TLB use only the first two cases unless page faults are explicitly mentioned.2
Footnotes
-
Translation Lookaside Buffer (TLB) in Paging - GeeksforGeeks - Stepwise explanation of TLB hit/miss flow and standard EMAT formula. ↩
-
Translation Lookaside Buffer (TLB) | COMS W4118 Operating Systems I - Effective access time discussion and why high hit ratio makes paging efficient. ↩
Advantages and limitations of the TLB scheme
Advantages
- It reduces average address-translation overhead by caching frequently used page-table entries.2
- It makes paging feasible for large address spaces where repeated page-table access would otherwise be too slow.2
- It exploits locality, so a relatively small hardware structure can provide large performance gains.2
Limitations
- TLB misses still incur additional latency because page-table walking is slower than a TLB hit.2
- Context switches may require flushing or tagging entries, introducing design complexity.2
- The TLB does not eliminate page faults; it only accelerates translation for pages that are already mapped and resident.2
Thus, the TLB should be understood as a high-speed translation cache that optimizes paging, not as a replacement for the page table itself.2
Footnotes
-
Translation lookaside buffer - Wikipedia - Overview of TLB purpose, hits, misses, and its role in reducing paging overhead. ↩ ↩2
-
Faster Translations (TLBs) - OSTEP PDF - Detailed academic treatment of TLBs, address translation, misses, and context-switch issues. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7
-
Lecture 18 Virtual Memory 2 - MIT PDF - Hardware-oriented notes on TLB design, ASIDs, hardware page walks, and page faults. ↩ ↩2 ↩3
-
Virtual Memory and Page Tables - University of Pennsylvania PDF - Lecture notes explaining TLB locality, small associative structures, and MMU refill behavior. ↩
-
Translation Lookaside Buffer | TLB | Paging | Gate Vidyalay - Concise explanation of paging with TLB, hit/miss behavior, and update process. ↩
Knowledge Check
What is the primary purpose of a TLB in a paging system?
Explore Related Topics
Compare Between Compile-Time, Load-Time, and Execution-Time Address Binding
Address binding maps a program’s symbolic or relocatable addresses to actual physical memory, and it can be performed at compile‑time, load‑time, or execution‑time.
- Compile‑time binding: the compiler produces absolute code; final addresses are fixed before loading and require recompilation if the start location changes.
- Load‑time binding: the loader relocates code using a base register (e.g., ); addresses are fixed after loading but no recompilation is needed.
- Execution‑time binding: the CPU generates logical addresses that the MMU translates on each reference, allowing the process to move while running and supporting paging, segmentation, and virtual memory.
Virtual Memory, Its Implementation, and the Role of the TLB
Virtual memory abstracts physical RAM by giving each process a large contiguous logical address space, implemented with paging, page tables, and a Translation Lookaside Buffer (TLB) that caches recent translations.
- Provides protection, simplifies programming, enables demand paging and sharing of code/pages.
- Virtual address = (VPN, offset); physical address = (PFN, offset) with VPN → PFN via TLB or page‑table walk.
- Effective access time: , so high TLB hit rate is critical.
- Multi‑level page tables reduce memory use for sparse address spaces.
- TLB reach = (entries) × (page size); exceeding it causes TLB thrashing and performance loss.
Purpose of the Modify Bit in a Page Table
The modify (dirty) bit in a page‑table entry signals whether a page in RAM has been altered since it was loaded from its backing store, guiding the OS during page replacement.
- If the bit is 0 the page is clean and can be discarded; if 1 it is dirty and must be written back before the frame is reused.
- Hardware (or the MMU) sets the bit automatically on any write to the page.
- Eviction cost:
- It works with other status bits (present, accessed) to support efficient replacement policies and avoid unnecessary disk I/O.
