Open In App

Difference Between Paging and Segmentation

Last Updated : 28 Dec, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

In computer operating systems, memory management is crucial for efficient use of resources. Paging and segmentation are two fundamental techniques used to organize and allocate memory. Paging divides memory into fixed-size blocks called pages, simplifying management by treating memory as a uniform structure.

Segmentation, in contrast, divides memory into variable-sized segments based on logical units, offering flexibility in organizing data and code. Both methods have distinct advantages and are chosen based on the specific needs and complexities of applications and system architectures.

What is Paging?

Paging is a method or technique which is used for non-contiguous memory allocation. It is a fixed-size partitioning theme (scheme). In paging, both main memory and secondary memory are divided into equal fixed-size partitions. The partitions of the secondary memory area unit and main memory area unit are known as pages and frames respectively. 

Paging is a memory management method accustomed to fetching processes from the secondary memory into the main memory in the form of pages. in paging, each process is split into parts wherever the size of every part is the same as the page size. The size of the last half could also be but the page size. The pages of the process area unit hold on within the frames of main memory relying upon their accessibility. 

PagingWhat is Segmentation?

Segmentation is another non-contiguous memory allocation scheme like paging. Like paging, in segmentation, the process isn’t divided indiscriminately into mounted(fixed) size pages. It is a variable-size partitioning theme. like paging, in segmentation, secondary and main memory are not divided into partitions of equal size. The partitions of secondary memory area units are known as segments. The details concerning every segment are hold in a table known as segmentation table. Segment table contains two main data concerning segment, one is Base, which is the bottom address of the segment and another is Limit, which is the length of the segment. 

In segmentation, the CPU generates a logical address that contains the Segment number and segment offset. If the segment offset is a smaller amount than the limit then the address called valid address otherwise it throws miscalculation because the address is invalid. 
 

Segmentation

The above figure shows the translation of a logical address to a physical address. 

Difference Between Paging and Segmentation

segment Table maintains the segment data.

Paging Segmentation
In paging, the program is divided into fixed or mounted size pages. In segmentation, the program is divided into variable size segments.
For the paging operating system is accountable. For segmentation compiler is accountable.
Page size is determined by hardware. Here, the segment size is given by the user.
It is faster in comparison to segmentation. Segmentation is slow.
Paging could result in internal fragmentation. Segmentation could result in external fragmentation.
In paging, the logical address is split into a page number and page offset. Here, the logical address is split into segment number and segment offset.
Paging comprises a page table that encloses the base address of every page. While segmentation also comprises the segment table which encloses segment number and segment offset.
The page table is employed to keep up the page data.
In paging, the operating system must maintain a free frame list. In segmentation, the operating system maintains a list of holes in the main memory.
Paging is invisible to the user. Segmentation is visible to the user.
In paging, the processor needs the page number, and offset to calculate the absolute address. In segmentation, the processor uses segment number, and offset to calculate the full address.
It is hard to allow sharing of procedures between processes.  Facilitates sharing of procedures between the processes.
In paging, a programmer cannot efficiently handle data structure. It can efficiently handle data structures.
This protection is hard to apply. Easy to apply for protection in segmentation.
The size of the page needs always be equal to the size of frames. There is no constraint on the size of segments.
A page is referred to as a physical unit of information. A segment is referred to as a logical unit of information.
Paging results in a less efficient system. Segmentation results in a more efficient system.

Conclusion

In conclusion, paging and segmentation are both methods used in operating systems to manage memory, but they approach memory organization differently. Paging divides memory into fixed-size blocks (pages) for efficient management and allocation, while segmentation divides memory into variable-sized logical units (segments) for more flexible data and code organization.



Next Article

Similar Reads