Paging splits logical memory into fixed-size pages and physical memory into equal frames, then a page table maps each page to a frame. It hides memory from the programmer and avoids external fragmentation, yet it wastes a little space inside the last page. Segmentation splits a program into variable-size segments that match its logical parts, such as code, data, and stack, and a segment table stores each segment’s base and limit. In short, paging is a physical, hardware view, while segmentation is a logical, programmer-visible view.
Paging and segmentation are the two classic schemes an operating system uses to manage memory. Both turn up in every operating-systems course and GATE syllabus. Students often blur how each one maps a logical address and which kind of fragmentation each one causes.
The core question is simple. Should memory be divided by a fixed physical size, or by the program’s own logical structure? Paging takes the first path, while segmentation takes the second. This guide defines each scheme, compares them in detail, and shows where each one fits.
If the address side still feels fuzzy, it helps to know the difference between logical and physical memory addresses first. It also helps to be clear on internal versus external fragmentation, because that distinction is the heart of this comparison.

What is Paging?
Paging divides the logical (virtual) address space into fixed-size blocks called pages. It also divides physical memory into equal-size blocks called frames. Because a page and a frame are the same size, the operating system can drop any page into any free frame, so the pages of one process need not sit together in memory.
A page table records the mapping, since it stores the frame number that holds each page. Hardware decides the page size, and a single page table entry also carries flag bits, such as valid, dirty, and protection bits, alongside that frame number. Paging stays invisible to the programmer, so the process simply sees one linear address space. As a result, paging removes external fragmentation, yet it still wastes a little space inside the final, partly used page.
Advantages of paging:
- No external fragmentation, because every frame is the same size and any frame fits any page.
- Simple allocation, since the system just grabs any free frames from a list.
- Invisible to the programmer, so each process sees one clean linear address space.
- Easy to support virtual memory, because unused pages can stay on disk until needed.
Disadvantages of paging:
- Internal fragmentation, since the last page of a process is rarely full.
- Page-table overhead, because large address spaces need large tables in memory.
- An extra memory lookup per access, unless a TLB caches recent translations.
- No natural sharing or protection of logical units like a single function or array.
What is Segmentation?
Segmentation divides a program into variable-size segments that match its logical parts. So one segment holds the code, another holds the global data, another holds the stack, and so on. Each segment can grow or shrink on its own, which makes the layout flexible.
A segment table stores two values for every segment: a base address and a limit, that is, the segment’s length. Unlike paging, segmentation is visible to the programmer, because the logical address is an explicit pair of a segment number and an offset. Therefore the user, not the hardware, effectively sets each segment’s size. This logical view supports natural sharing and protection, since the system can mark a whole code segment as read-only or share it between processes. However, the variable sizes leave gaps in memory, so segmentation suffers from external fragmentation.
Advantages of segmentation:
- No internal fragmentation, because each segment is sized to its actual contents.
- A logical view that mirrors the program’s own structure, so code is easier to organise.
- Natural sharing, since a shared library or code segment maps cleanly between processes.
- Per-segment protection, because the segment table can mark a segment read-only or execute-only.
Disadvantages of segmentation:
- External fragmentation, since variable-size segments leave scattered free gaps.
- Harder allocation, because the system must find a hole large enough for each segment.
- A limit check on every access, which adds a little work to address translation.
- Visible complexity, as the programmer or compiler must manage the segment structure.
Paging vs Segmentation: Comparison Table

| Aspect | Paging | Segmentation |
|---|---|---|
| Block type | Divides the program into fixed-size pages | Divides the program into variable-size segments |
| Block size set by | Hardware decides the page size | The user or compiler specifies the segment size |
| Programmer view | Invisible to the programmer | Visible to the programmer |
| Speed | Faster than segmentation | Slower |
| Mapping table | A page table holds the page information | A segment table holds the segment information |
| Logical address | Split into page number and page offset | Split into segment number and segment offset |
| Address space | One linear address space | Multiple linear address spaces |
| Table entry | Page table entry has flag bits and a frame number | Segment table entry has protection bits and the segment base address |
| Fragmentation | Suffers from internal fragmentation | Suffers from external fragmentation |
| Logical partitioning | Does not allow logical partitioning of application components | Allows logical partitioning and protection of application components |
| Protection mechanism | Does not provide a per-unit protection mechanism | Provides security associated with each segment |
| Limit field | Not needed, because all pages share one size | Each segment stores a limit, that is, its length |
| Sharing | Possible only at page boundaries | Natural, since a whole logical segment can be shared |
| Reflects program structure | No, the split is purely physical | Yes, each segment maps to a logical unit |
| Typical use | Virtual memory in most modern operating systems | Logical grouping, often combined with paging |
How Address Translation Works

The clearest way to see the gap is to follow one logical address through each scheme.
Under paging, the logical address is one plain number. The hardware splits it automatically into a page number and an offset. The page number indexes the page table to find the matching frame number. Then the hardware joins that frame number with the same offset to form the physical address. So the programmer never sees pages at all, because the split is automatic.
Under segmentation, the logical address is instead an explicit pair: a segment number and an offset within that segment. The segment number indexes the segment table to read the segment’s base and limit. First the hardware checks that the offset is below the limit, which protects against out-of-bounds access. Then it adds the base to the offset to form the physical address.
For a concrete example, picture a 4 KB page size. A logical address of 9000 falls in page 2, since 9000 divided by 4096 leaves an offset of 808. If the page table maps page 2 to frame 5, then the physical address becomes frame 5 plus offset 808. Segmentation handles the same task differently, because you would instead name the segment directly, say segment 3, offset 808, and the hardware would add segment 3’s base to 808.
Segmented Paging: The Best of Both
Paging and segmentation are not strictly rivals, so many real systems combine them. This hybrid is called segmented paging, and it gives the logical view of segmentation without the external fragmentation of pure segments.
The idea is simple. First the program is divided into logical segments, just as in segmentation. Then each segment is itself divided into fixed-size pages, just as in paging. As a result, the system keeps the clean logical structure and per-segment protection, yet it allocates physical memory in uniform frames. Therefore external fragmentation disappears, while the programmer still works with meaningful segments.
When to Use Paging or Segmentation
You rarely pick one scheme by hand, yet the trade-off still shapes real designs.
Choose paging when simple, efficient physical-memory use matters most. Virtual memory in modern operating systems leans on paging, because equal frames make allocation easy and remove external fragmentation. So paging suits the general case of running many processes side by side.
Choose segmentation when the logical structure and protection of a program matter most. Sharing a code library, isolating a stack, or marking data read-only all map cleanly onto segments. In practice, though, most systems combine the two through segmented paging, so they gain the strengths of each at once.
Interview Questions
Frequently Asked Questions
Wrapping Up
Paging and segmentation solve the same problem from opposite directions. Paging divides memory by a fixed physical size, while segmentation divides it by the program’s own logical structure.
Remember the simple rule: paging gives equal pages, one linear space, and internal fragmentation, whereas segmentation gives variable segments, a logical view, and external fragmentation. In practice, modern systems often blend the two through segmented paging. Still, knowing this core trade-off is enough to answer most exam and interview questions on the pair.
Related reading on DiffStudy: