Paging is a method or techniques 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 secondary memory area unit and main memory area unit known as as pages and frames respectively.
Paging is a memory management method accustomed fetch processes from the secondary memory into the main memory in the form of pages. in paging, each process is split into parts wherever size of every part is same as the page size. The size of the last half could also be but the page size. The pages of process area unit hold on within the frames of main memory relying upon their accessibility.
Segmentation is another non-contiguous memory allocation scheme like paging. like paging, in segmentation, process isn’t divided indiscriminately into mounted(fixed) size pages. It is 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 unit known as as segments. The details concerning every segment are hold in a table known as 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, CPU generates logical address that contains 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.
The above figure shows the translation of logical address to physical address.
Difference between Paging and Segmentation:
|1.||In paging, program is divided into fixed or mounted size pages.||In segmentation, program is divided into variable size sections.|
|2.||For paging operating system is accountable.||For segmentation compiler is accountable.|
|3.||Page size is determined by hardware.||Here, the section size is given by the user.|
|4.||It is faster in the comparison of segmentation.||Segmentation is slow.|
|5.||Paging could result in internal fragmentation.||Segmentation could result in external fragmentation.|
|6.||In paging, logical address is split into page number and page offset.||Here, logical address is split into section number and section offset.|
|7.||Paging comprises a page table which encloses the base address of every page.||While segmentation also comprises the segment table which encloses segment number and segment offset.|
|8.||Page table is employed to keep up the page data.||Section Table maintains the section data.|
|9.||In paging, operating system must maintain a free frame list.||In segmentation, operating system maintain a list of holes in main memory.|
|10.||Paging is invisible to the user.||Segmentation is visible to the user.|
|11.||In paging, processor needs page number, offset to calculate absolute address.||In segmentation, processor uses segment number, offset to calculate full address.|
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.