Both of these are techniques of memory management with major variations in their elements. In this article, we will discuss the difference between Paging and Segmentation. But let us first know more about them individually. Read ahead to know more.
What is Paging?
It is a technique of memory management that breaks the process address space into various blocks of similar sizes, known as pages. Here, we measure the size of a process in the total number of pages. In a similar manner, the main memory gets divided into various frames. The frames are small physical memory blocks of fixed size. We keep the overall size of a given frame to a page so that we can utilize the main memory in the most optimum manner. It also avoids external fragmentation.
What is Segmentation?
It is a technique of memory management in which every job gets divided into various blocks of varied sizes, known as segments. This way, we get one segment for every module with pieces performing related functions. These segments act as different spaces of the logical address of any program. While executing a process, the corresponding segmentations load into a non-contagious form of memory. It happens even if every segmentation loads into the available memory’s contagious block.
Management of segmentation memory works similar to that of paging. The only difference is that the length of segments is varied, and the pages have a fixed size. The segment of a program has the program’s data structures, functions, utility, main function, and more. The OS (operating system) primarily maintains segment tables for individual processes along with a list of all memory blocks that are free. It also includes the segment numbers and size, along with their locations in the main memory.
For individual segments, the table mainly stores the segment’s starting address along with its length. The memory location’s reference includes the values identifying the segment along with their offset.
Here is the difference between Paging and Segmentation in a tabular form:
Difference Between Paging and Segmentation
|In Paging, we break a process address space into blocks known as pages.
|In the case of Segmentation, we break a process address space into blocks known as sections.
|The pages are blocks of fixed size.
|The sections are blocks of varying sizes.
|The OS divides the available memory into individual pages.
|The compiler mainly calculates the size of individual segments, their actual address as well as virtual address.
|This technique is comparatively much faster in accessing memory.
|This technique is comparatively much slower in accessing memory than Paging.
|The available memory determines the individual page sizes.
|The user determines the individual segment sizes.
|The Paging technique may underutilize some of the pages- thus leading to internal fragmentation.
|The Segmentation technique may not use some of the memory blocks at all. Thus, it may lead to external fragmentation.
|A logical address divides into page offset and page number in the case of Paging.
|A logical address divides into section offset and section number in the case of Segmentation.
|In the case of Paging, the page table leads to the storage of the page data.
|In the case of Segmentation, the segmentation table leads to the storage of the segmentation data.
Keep learning and stay tuned to BYJU’S to get the latest updates on GATE Exam along with GATE Eligibility Criteria, GATE 2024, GATE Admit Card, GATE Application Form, GATE Syllabus, GATE Cutoff, GATE Previous Year Question Paper, and more.