What is Paging?Paging is a storage mechanism that allows OS to retrieve processes from the secondary storage into the main memory in the form of pages. In the Paging method, the main memory is divided into small fixed-size blocks of physical memory, which is called frames. The size of a frame should be kept the same as that of a page to have maximum utilization of the main memory and to avoid external fragmentation. Paging is used for faster access to data, and it is a logical concept.
You are watching: What is the purpose of paging the page tables?
In this Paging tutorial, you will learn:
For example, if the main memory size is 16 KB and Frame size is 1 KB. Here, the main memory will be divided into the collection of 16 frames of 1 KB each.
There are 4 separate processes in the system that is A1, A2, A3, and A4 of 4 KB each. Here, all the processes are divided into pages of 1 KB each so that operating system can store one page in one frame.
At the beginning of the process, all the frames remain empty so that all the pages of the processes will get stored in a contiguous way.
In this example, you can see that there are eight non-contiguous frames which is available in the memory, and paging offers the flexibility of storing the process at the different places. This allows us to load the pages of process A5 instead of A2 and A4.
What is Paging Protection?
The paging process should be protected by using the concept of insertion of an additional bit called Valid/Invalid bit. Paging Memory protection in paging is achieved by associating protection bits with each page. These bits are associated with each page table entry and specify protection on the corresponding page.
Advantages of Paging
Here, are advantages of using Paging method:Easy to use memory management algorithmNo need for external FragmentationSwapping is easy between equal-sized pages and page frames.
Disadvantages of Paging
Here, are drawback/ cons of Paging:May cause Internal fragmentationPage tables consume additonal memory.Multi-level paging may lead to memory reference overhead.
What is Segmentation?
Segmentation method works almost similarly to paging, only difference between the two is that segments are of variable-length whereas, in the paging method, pages are always of fixed size.
See more: Difference Between Monocot And Dicot Roots, Monocots Vs Dicots: What You Need To Know
A program segment includes the program’s main function, data structures, utility functions, etc. The OS maintains a segment map table for all the processes. It also includes a list of free memory blocks along with its size, segment numbers, and it’s memory locations in the main memory or virtual memory.
Advantages of a Segmentation method
Here, are pros/benefits of SegmentationOffer protection within the segmentsYou can achieve sharing by segments referencing multiple processes.Not offers internal fragmentationSegment tables use lesser memory than paging
Disadvantages of Segmentation
Here are cons/drawback of SegmentationIn segmentation method, processes are loaded/ removed from the main memory. Therefore, the free memory space is separated into small pieces which may create a problem of external fragmentationCostly memory management algorithm