📈 Performance Calculations (Interview Math)
Effective Access Time (EAT):
EAT = (1 + α) × ma
Where: α = page fault rate, ma = memory access time
With TLB:
EAT = α × (TLB access time + memory access time) + (1-α) × (TLB access time + 2 × memory access time)
Where: α = TLB hit rate
Example:
TLB hit rate = 90%, TLB access = 1ns, Memory access = 100ns
EAT = 0.9 × (1 + 100) + 0.1 × (1 + 200) = 111.1ns
🎯 Top Interview Questions & Answers
Q1: Why is paging better than contiguous allocation?
A: Paging eliminates external fragmentation by allowing non-contiguous allocation. Processes can be loaded even if no single large contiguous block is available, improving memory utilization and reducing need for compaction.
Q2: How does TLB improve paging performance?
A: TLB is a hardware cache that stores recent page-to-frame mappings. Without TLB, each memory access requires 2 memory accesses (page table + actual data). With TLB hit, only 1 memory access is needed, nearly doubling performance.
Q3: What happens on a TLB miss?
A: On TLB miss, system accesses page table in memory, retrieves frame number, updates TLB with this mapping, then accesses actual data. This results in 2 memory accesses but improves future accesses to the same page.
Q4: How do you calculate physical address from logical address?
A: Split logical address into page number and offset. Use page number as index into page table to get frame number. Physical address = (frame number × page size) + offset.
Q5: What is internal fragmentation in paging?
A: Internal fragmentation occurs when a process doesn't fully utilize its last page. For example, if page size is 4KB and process needs 10KB, it gets 3 pages (12KB), wasting 2KB in the last page.
Q6: Why do we need ASID in TLB?
A: ASID (Address Space Identifier) prevents conflicts between different processes. Without ASID, TLB would need to be flushed on every context switch. ASID allows TLB to hold entries for multiple processes simultaneously.
📝 Key Revision Points
Paging Basics: Fixed-size pages (logical) map to fixed-size frames (physical). Page size = Frame size (typically 4KB).
Address Translation: Logical address = Page number + Offset → Physical address = Frame number + Offset
TLB: Hardware cache for page table entries. Typical hit rate 90-99%. Reduces memory accesses from 2 to 1.
Page Table Types: Single-level (simple), Multi-level (space efficient), Inverted (fixed size), Hashed (sparse