Paging vs Segmentation
Paging is a memory management method used by operating systems. Paging allows the main memory to use data that is residing on a secondary storage device. These data are stored in the secondary storage device as blocks of same size called pages. Paging allows the operating system to use data that will not fit in to the main memory. Memory segmentation is a method that provides memory protection. Each memory segment is associated with a specific length and a set of permissions. When a process tries to access the memory it is first checked to see whether it has the required permission to access the particular memory segment.
What is Paging?
Paging is a memory management method used by operating systems. Paging allows the main memory to use data that is residing on a secondary storage device. These data are stored in the secondary storage device as blocks of same size called pages. Paging allows the operating system to use data that will not fit in to the main memory. When a program tries access a page, first the page table is checked to see whether that page is on the main memory. Page table holds details about where the pages are stored. If it is not in the main memory, it is called a page fault. Operating system is responsible for handling page faults without showing it to the program. The operating system first finds where that particular page is stored in the secondary storage and then brings it in to an empty page frame in the main memory. Then it updates the page table to indicate that the new data is in the main memory and returns the control back to the program that initially requested the page.
What is Segmentation?
Memory segmentation is a method that provides memory protection. Each memory segment is associated with a specific length and a set of permissions. When a process tries to access the memory it is first checked to see whether it has the required permission to access the particular memory segment and whether it is within the length specified by that particular memory segment. If either of these conditions is not satisfied, a hardware exception is raised. In addition, a segment may also have a flag indicating whether the segment is in the main memory or not. If the segment is not residing in the main memory, an exception will be raised and the operating system will bring the segment from the secondary memory to the main memory.
What is the difference between Paging and Segmentation?
In paging, memory is divided in to equal size segments called pages whereas memory segments could vary in size (this is why each segment is associated with a length attribute). Sizes of the segments are determined according to the address space required by a process, while address space of a process is divided in to pages of equal size in paging. Segmentation provides security associated with the segments, whereas paging does not provide such a mechanism.
bale30 says
thanks 🙂