Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Difference between Paging and Segmentation
Paging and Segmentation are two memory management techniques used by operating systems to efficiently allocate memory to processes. Paging divides memory into fixed-size blocks, while segmentation divides it into variable-size logical units.
Paging
Paging is a memory management technique in which a process address space is broken into fixed-size blocks called pages (typically a power of 2, between 512 bytes and 8192 bytes). Main memory is similarly divided into fixed-size blocks called frames, with frame size equal to page size. This ensures optimum utilization of main memory and avoids external fragmentation.
Segmentation
Segmentation is a memory management technique in which each process is divided into several segments of different sizes, one for each logical module (main function, utility functions, data structures, etc.). Each segment represents a different logical address space. Segments are loaded into non-contiguous memory, but each individual segment occupies a contiguous block. The OS maintains a segment map table storing the starting address and length of each segment.
Key Differences
| Feature | Paging | Segmentation |
|---|---|---|
| Block Size | Fixed-size pages | Variable-size segments |
| Managed By | Operating system | Compiler (calculates segment sizes and addresses) |
| Size Determined By | Available memory (hardware) | Logical structure of the program (user/compiler) |
| Speed | Faster memory access | Slower than paging |
| Fragmentation | Internal fragmentation (underutilized pages) | External fragmentation (unused memory gaps) |
| Logical Address | Page number + page offset | Segment number + segment offset |
| Lookup Table | Page table (page → frame mapping) | Segment table (base address + length) |
Conclusion
Paging divides memory into equal fixed-size blocks for simple and fast allocation but may cause internal fragmentation. Segmentation divides memory into variable-size logical units matching program structure but may cause external fragmentation. Many modern operating systems combine both techniques (segmented paging) to get the benefits of each.
