Compare, Distinguish and explain what is the difference between Paging and Segmentation. Comparison and Differences.
Paging: Physical address space of a process can be noncontiguous; process allocates physical memory whenever the latter is available. It divide physical memory into fixed-sized blocks called frames. Size is power of 2, between 512 bytes and 16 Mbytes. Also, it divide logical memory into blocks of same size called pages. To run a program of size N pages, need to find N free frames and load program. Backing store likewise split into pages. Set up a page table to translate logical to physical addresses. System keeps track of all free frames.
Segmentation: Segmentation is Memory-management scheme that supports user view of memory. A program is a collection of segments. A segment is a logical unit such as: main program, procedure, function, method, object, local variables, global variables, common block, stack symbol, table, arrays.
Difference between Paging and Segmentation
1. Paging is a memory management scheme. Segmentation is also a memory management scheme.
2. In paging, Operating system must maintain a page table for each process showing which frame each page occupies. In segmentation, operating system must maintain a segment table for each process showing the base address and length of each segment.
3. Operating system must maintain a free frame list in paging. Operating system must maintain a list of free holes in main memory in segmentation.
4. In paging, processor uses page number and offset to calculate the absolute address. In segmentation, processor uses segment number and offset to calculate absolute address.
5. In paging, all the pages of a process must be in main memory to run, unless overlays are used. In segmentation, all the segments of a process must be in main memory for process to run unless overlays are used.
Also read: Differences between Primary vs. Secondary Memory