Difference between Paging and Segmentation

Operating SystemInternetComputer Network

Paging

Paging is a memory management technique in which process address space is broken into blocks of the same size called pages (size is power of 2, between 512 bytes and 8192 bytes). The size of the process is measured in the number of pages. Similarly, main memory is divided into small fixed-sized blocks of (physical) memory called frames and the size of a frame is kept the same as that of a page to have optimum utilization of the main memory and to avoid external fragmentation.

Similarly, main memory is divided into small fixed-sized blocks of (physical) memory called frames and the size of a frame is kept the same as that of a page to have optimum utilization of the main memory and to avoid external fragmentation.

Segmentation

Segmentation is a memory management technique in which each job is divided into several segments of different sizes, one for each module that contains pieces that perform related functions. Each segment is actually a different logical address space of the program. When a process is to be executed, its corresponding segmentation are loaded into non-contiguous memory though every segment is loaded into a contiguous block of available memory. Segmentation memory management works very similar to paging but here segments are of variable-length where as in paging pages are of fixed size.

A program segment contains the program's main function, utility functions, data structures, and so on. The operating system maintains a segment map table for every process and a list of free memory blocks along with segment numbers, their size and corresponding memory locations in main memory. For each segment, the table stores the starting address of the segment and the length of the segment. A reference to a memory location includes a value that identifies a segment and an offset.

Following are the important differences between Paging and Segmentation.

Sr. No.KeyPagingSegmentation
1Memory SizeIn Paging, a process address space is broken into fixed sized blocks called pages.In Segmentation, a process address space is broken in varying sized blocks called sections.
2AccountabilityOperating System divides the memory into pages.Compiler is responsible to calculate the segment size, the virtual address and actual address.
3SizePage size is determined by available memory.Section size is determined by the user.
4SpeedPaging technique is faster in terms of memory access.Segmentation is slower than paging.
5FragmentationPaging can cause internal fragmentation as some pages may go underutilized.Segmentation can cause external fragmentation as some memory block may not be used at all.
6Logical AddressDuring paging, a logical address is divided into page number and page offset.During segmentation, a logical address is divided into section number and section offset.
7TableDuring paging, a logical address is divided into page number and page offset.During segmentation, a logical address is divided into section number and section offset.
8Data StoragePage table stores the page data.Segmentation table stores the segmentation data.
raja
Published on 28-Nov-2019 16:04:40
Advertisements