Definition:
Paging is a memory management technique used by operating systems to eliminate external fragmentation and efficiently manage memory. It divides physical memory and logical memory (process address space) into fixed-size blocks:
Each page of a process is mapped to a frame in physical memory using a page table.
-
Pages and frames are usually of the same size (e.g., 4 KB).
-
The OS uses a page table to keep track of which page is stored in which frame.
-
No external fragmentation, but internal fragmentation may occur.
Example:
Assume:
-
Page size = Frame size = 1 KB
-
A process has 4 pages: P0, P1, P2, P3
-
Available physical memory frames: F2, F5, F1, F7
The OS loads pages into frames as follows:
| Page |
Frame |
| P0 |
F2 |
| P1 |
F5 |
| P2 |
F1 |
| P3 |
F7 |
Now, suppose the process wants to access logical address 2050:
-
Since page size is 1024 bytes (1 KB),
Logical address 2050 lies in Page 2 (2050 ÷ 1024 = 2, remainder 2)
-
Offset within the page = 2050 % 1024 = 2
-
Page 2 is stored in Frame 1, so physical address =
Frame 1 base address (1×1024) + offset (2) = 1026
Advantages:
Disadvantages: