# Virtual Memory, Multi-Level Paging & TLB Effective Access Time
Exam: GATE Computer Science & Information Technology (GATE CS)
Subject: Operating Systems
Canonical URL: https://gateandnet.com/exams/gate-cs/operating-systems/virtual-memory-paging-and-tlb

> Virtual/physical address bit calculations, optimal page size for multi-level page tables, EMAT, and Belady’s anomaly.

## Page Replacement Algorithms & Belady’s Anomaly

| Algorithm | Suffers from Belady’s Anomaly? | Stack Property? | Notes |
| :--- | :---: | :---: | :--- |
| **FIFO** | 🚨 **YES** (e.g. 3 vs 4 frames on `1,2,3,4,1,2,5,1,2,3,4,5`) | No | Oldest loaded page evicted |
| **Optimal (OPT / Belady)** | **No** | **Yes** | Provably minimum page faults (non-causal benchmark) |
| **LRU (Least Recently Used)** | **No** | **Yes** | Approximated in hardware using Reference/Clock bit |


## Solved Practice Questions & PYQs

### [GATE CS OS TLB | NAT]
A paging system uses a single-level page table in main memory ($100\text{ ns}$ access time) and a TLB ($20\text{ ns}$ lookup time) with a **TLB hit ratio of $80\%$**. Assuming sequential TLB-then-memory lookup, what is the **Effective Memory Access Time (EMAT)** in nanoseconds?
**Correct Answer:** 140
**Solution:** $$\text{EMAT} = 0.80(20 + 100) + 0.20(20 + 200) = 96 + 44 = \mathbf{140\text{ ns}}$$
