1Definition
Paging is a non-contiguous memory management scheme that divides physical RAM into fixed-size blocks called Frames and logical program memory into equal-sized blocks called Pages. Address mapping is managed via a Page Table. A Translation Lookaside Buffer (TLB) is a high-speed hardware associative associative cache built into the CPU to accelerate virtual-to-physical address translation.
2Simple Explanation
The main drawback of contiguous memory allocation is that a process must be loaded in one big continuous block, causing external fragmentation. Paging eliminates this completely!
Instead of requiring one continuous block, the OS chops the process into fixed 4KB chunks called Pages, and chops physical RAM into matching 4KB slots called Frames. Now, pages can be scattered anywhere into any open frames in RAM!
To keep track of where every page landed, the OS creates a Page Table for the process. Because checking the Page Table in RAM doubles memory access time, CPU hardware includes a super-fast hardware cache called the TLB. The TLB remembers recent page-to-frame translations, speeding up execution.
3Real-Life Example / Analogy
A Binder with Loose-Leaf Paper: A textbook is printed on standard 8.5x11 loose-leaf pages. You can store Page 1 in Slot 1 of a binder, Page 2 in Slot 4, and Page 3 in Slot 9. As long as you maintain a Table of Contents (Page Table) at the front of the binder listing Page 1 -> Slot 1, Page 2 -> Slot 4, you can read the book sequentially without needing pages to be glued together continuously.
4Diagram / Visual Representation
5Working / How It Works
- Logical Address Structure: .
- Address Translation Sequence:
- CPU generates logical address .
- MMU checks high-speed TLB hardware cache for Page .
- TLB Hit: If exists in TLB, frame number is retrieved in 1 CPU cycle.
- TLB Miss: If is not in TLB, MMU fetches frame from Page Table in RAM (costs extra RAM access cycle) and updates TLB with .
- Physical Address Construction: . Physical RAM location accessed.
6Types / Components / Characteristics
- Paging Structural Rule: Page Size MUST Always Equal Frame Size (Typically 4096 bytes / 4KB).
- Page Table Components:
- PTBR (Page Table Base Register): Points to current process Page Table location in RAM.
- ASID (Address Space Identifier): Unique tag stored in TLB entries identifying process ownership, allowing TLB to store entries for multiple processes simultaneously without cache flushes on context switch.
- Fragmentation Characteristics: Paging has Zero External Fragmentation, but suffers from minor Internal Fragmentation on the final page of a process.
7Solved Examples / Problems
Problem: A system has a Page Size of 1 KB (1024 bytes). A process generates Logical Address 3000. Calculate the Page Number () and Page Offset ().
Solution:
- Result: Logical address 3000 corresponds to Page 2, Offset 952.
8Advantages, Disadvantages & Applications
- Paging Advantages: Eliminates external fragmentation entirely; allows non-contiguous physical memory allocation.
- Disadvantages: Page table storage consumes RAM; TLB misses cause memory lookup delays.
9Important Points to Remember
- .
- Paging has zero external fragmentation, but minor internal fragmentation (average half page per process).
- TLB uses ASID to provide address space protection across processes.
10Test Your Understanding
- MCQ: What type of memory fragmentation can still occur in a Paging system?
- A) Severe External Fragmentation
- B) Compaction Fragmentation
- C) Minor Internal Fragmentation on the last page of a process
- D) Segmentation Allocation Fault
Show answer
C. - Conceptual Question: Explain the operational mechanics of a TLB Hit versus a TLB Miss.
- Application Question: Convert Logical Address
5000to its Page Number and Offset given a Page Size of 2048 bytes (2KB).
