Types of paging in OS [Operating System]

The paging concept in the operating system helps in the efficient utilization of memory management. Let’s understand the concept of paging, when the process requires to be executed then the operating system divided the process into fixed-size frames and these frame sizes are the same as the frame size of the primary memory such as RAM, and when the process is ready for the execution the operating system loads all the frames of the process into the primary memory so that CPU is able to perform execution on each frame. And when some frames are left or not able to load and the CPU requires those frames for execution and the frames are residing in the secondary memory and not in the main memory then the CPU calls for a page fault and demands those frames into the primary memory and this finishes the execution of the process.¬†

There are various ways in which paging occurs in the operating system these are-

Demand paging

As the name suggests demand paging occurs when the CPU calls for the pages that are residing in the secondary memory into the primary memory. For example, a process is in execution by the operating system and this process requires some instructions of the other process therefore the CPU will demand those specific frames from the pages into the main memory to be loaded for the execution of the first process. 

Loader paging

The loader paging assumes that the program will be executed completely. Therefore all the process which makes the program has to be executed completely, therefore, all the processes are loaded and all the process has pages associated with them that are residing in the secondary memory and have to be loaded into the primary memory therefore as all the process are loaded therefore all the pages are also loaded into the primary memory.

Anticipatory paging

This paging loads up all the pages that are likely to be referenced in the near future by any processes that are executing in the CPU. The anticipatory loading helps to reduce the number of page faults that occur to call the pages from the secondary memory into the primary memory and therefore helps in faster execution of the programs.

Swap prefetch

The swap prefetch acts like a heuristic function that will load all the pages that have chances to be referenced by any process in the future. For example, if some pages are loaded from the primary memory by the page fault then the swap prefetch will likely to call for more pages that are near to the pages that have been called recently 

Pre-cleaning

The Unix operating system cleans all the pages before the execution of the new process. The starting of the new programs therefore runs faster because it is loaded when all the previous pages were cleaned from the primary memory.

Leave a Comment