
Before deep-diving into the differences between paging and segmentation, let's first understand memory management since the duo paging and segmentation are techniques of memory management.
Theoperating system is part of the memory of a multiprogramming computer, while multiple processes use the rest. Memory management is the responsibility of dividing memory among the various processes.
The fundamental goal of memory management is to make optimal use of memory by minimizing internal and external fragmentation. At one moment, a single process is loaded into memory that can be allocated in contiguous or non-contiguous memory/partitions.
Paging and segmentation are parts of the non-contiguous allocation of memory which is a memory management technique. We'll look at two memory management schemes -Paging and Segmentation in this article.
Paging is a static memory allocation method that allows a process's physical address space to be of non-contiguous memory type. It is a storage method that allows the operating system to retrieve processes in the form of pages from secondary storage and store them in the main memory.
Physical memory is divided into blocks of the same size that are called frames and logical memory space is divided into the fixed-sized block that are called pages.
The logical address space or virtual address and physical addresses are separated in paging. Logical address consisting of a page number and offset. Physical address consisting of a frame number and offset.
The page table base register (PTBR) refers to a process's page table. A virtual memory processor must have a distinct page table base register that is accessible by the operating system. The page table length register (PTLR) indicates the size of the page table

To facilitate paging, the operating system determines:
Every new process creates a separate page table. A page table is used in paging, and it contains the base address of each page. The page table is stored in physical memory.
Page table has page table entries(PTE) where each page table entry stores a frame number and optional status bits. Many status bits are used in the virtual memory system. Page table entry has the following information:
Frame number, Valid bit, Control bits, Referenced bit, Caching, Modified bit (dirty bit).

Page table can be implemented usingSingle level page tables stored in main memory, multi-level page tables stored in main memory, associative memory(Registers or TLB), or inverted page tables.
Instead of partitioning memory into pages of identical size, virtual address space or process address space is divided into variable-size segments. The modular structure of how a program is organized is represented by segments.
Segmentation is a memory management method in which each job is broken into numerous smaller segments, one for each module, each of which contains parts that execute related functions.Segments are variable-sized block of a program that corresponds to logical units of the program.
All program segments must be put into memory before they can run. Every segment requires the OS to locate contiguous memory blocks to allocate to it. The logical address consists of two parts: segment number and offset.
Mapping from logical address to physical address is done with the help of a segment table. The location of the segment table in memory is indicated by the segment-table base register (STBR), while the number of segments used by a program is indicated by the segment-table length register (STLR).


Paging | Segmentation |
| A program is divided into fixed-size pages. | A program is divided into variable-size segments. |
| The operating system is in charge of paging. | Segmentation is the responsibility of the user/compiler. |
| In terms of memory access, paging is faster than segmentation. | Segmentation is slower than paging |
| It suffers from internal fragmentation. | It suffers from external fragmentation. |
| Logical address space is divided into a page number and page offset. | Logical memory address space is divided into a segment number and segment offset. |
| To keep track of virtual pages, paging requires a page table. | To keep track of virtual pages, segmentation requires a segmentation table. |
| The page table has one entry for each virtual page. | The segment table has one entry for each virtual segment. |
| The operating system must maintain a free frame list. | The operating system must keep a list of holes in the main memory. |
| Paging is invisible to the user | Segmentation is visible to the user. |
| Page table entry has frame number and additional protected bits for pages | Segment table entry has a limit, base, and may contain some bits for the protection of segments. |
Operating systems employ paging and segmentation as two memory management strategies to control the computer's main memory. While segmentation splits the program into segments of varying sizes, paging divides memory into fixed-size blocks known as pages.
Modern operating systems commonly mix paging and segmentation to efficiently manage memory, as both techniques have advantages and disadvantages.
Together, segmentation and paging improve memory utilization, reduce external fragmentation, provide efficient memory allocation, and provide security. The choice between segmentation and paging depends on the particular requirements and constraints of the system and usually calls for striking a balance between flexibility, performance, and overhead.
Operating systems employ segmentation, a memory management method, to divide the main memory of the computer into segments or parts. Every segment is a logical address area in the program that houses components that carry out associated tasks. Processes may be assigned memory blocks of varying sizes using segmentation, which can increase memory utilization and decrease fragmentation. A reference to a memory location in a computer system that uses segmentation includes a value that designates a segment as well as an offset (memory address) inside that segment.
When there is sufficient total memory to fulfill a request or accommodate a process, but the memory is non-contiguous and cannot be utilized, external fragmentation—a sort of fragmentation occurs.
External fragmentation occurs with segmentation and dynamic partitioning. In segmentation, the memory is divided into variable-sized segments, and each segment is loaded into the main memory by creating partitions dynamically matching the size of each segment.
Some disadvantages of using segmentation as memory management are:
Variable-sized data structures can be supported effectively by the memory management approach of segmentation. The program is divided into segments of varying sizes, and each segment is loaded into main memory by partitioning the memory in a way that is dynamically matched to the size of each segment.
In order to increase memory utilization and decrease fragmentation, segmentation enables the distribution of memory blocks of different sizes to processes. At the same time as enabling variable-sized memory allocation, segmentation offers effective memory allocation and protection.
When a process tries to access data or code that is in its address space but is not now present in the system RAM, it will throw a page fault exception. Apage fault alerts the operating system, which then locates the needed page in virtual memory and moves it from secondary storage (such a hard drive) to the main memory. Page faults are used in paging to enable the operating system to load the requested page from virtual memory into physical memory so that the operation can proceed.
The virtual memory system of a computer operating system stores the mapping between virtual addresses and physical addresses in a data structure called a page table. Virtual address translation, which is required to access data in memory, heavily relies on the page table. The page table is made up of an array of page table entries, each of which provides details on a specific page of memory. The page table entry contains details on the page's physical address, status, and additional characteristics. The memory management unit (MMU) uses the page table to convert virtual addresses into physical addresses.
Hope you found the article interesting. For more such articles, stay tuned toUnstop!
Test Your Skills: Quiz Time
You might also be interested in reading:
As a biotechnologist-turned-writer, I love turning complex ideas into meaningful stories that inform and inspire. Outside of writing, I enjoy cooking, reading, and travelling, each giving me fresh perspectives and inspiration for my work.
And access exclusive content, personalized recommendations, and career-boosting opportunities.

to our newsletter



