Introduction to Paging
What you'll learn: You'll understand how paging eliminates external fragmentation by dividing memory into uniform, fixed-size blocks.
The Problem Paging Solves
Remember from earlier lessons that contiguous memory allocation suffers from external fragmentation—free memory scattered in small holes that can't satisfy larger allocation requests, even when the total free space is sufficient. This wastes memory and requires costly compaction.
What is Paging?
Paging is a memory management scheme that eliminates external fragmentation by breaking both physical memory and virtual address spaces into fixed-size blocks:
- Frames: Fixed-size blocks of physical memory (typically 4KB each)
- Pages: Fixed-size blocks of a process's virtual address space (same size as frames)
Instead of allocating memory contiguously, the operating system maps any available frame to any page. A process's pages don't need to occupy consecutive frames—they can be scattered throughout physical memory.
How It Works Simply
Think of memory like a bookshelf divided into identical-sized slots. Each book (page) fits perfectly into any slot (frame). You don't need consecutive slots for one book collection—slot 3, 15, and 42 work just fine. The page table acts like your catalog, tracking which slot holds which book.
Because every allocation uses the same fixed size, you never have "gaps too small to use." Any frame can hold any page. The only wasted space is internal fragmentation—unused bytes within a page when a process doesn't need the full page size.
Key Takeaway: Paging eliminates external fragmentation by dividing memory into fixed-size frames and pages, allowing any page to map to any available frame without requiring contiguous allocation.