What is the difference between paging and segmentation?
Interview preparation resource from Gate Smashers.
Paging divides memory into fixed-size pages and frames, while segmentation divides a program into variable-size logical regions such as code, data and stack.
With paging, any virtual page can be placed in any free physical frame. This avoids external fragmentation and makes allocation predictable, although the unused space in the final page of an allocation can cause internal fragmentation.
Segmentation matches the programmer's logical view and can apply protection or sharing to meaningful regions. Because segments have different sizes and traditionally require suitable contiguous placement, free space can become scattered into external holes. Modern systems mainly rely on paging, sometimes combined with architectural segmentation support.
Paging is widely used because fixed-size units simplify allocation and remove external fragmentation, although unused space inside the final page creates internal fragmentation. Segmentation matches logical program regions more naturally but makes free-space management and compaction more difficult.
