/    /  OS – Paging in Operating System

Paging in Operating System

 

What is paging?

Paging helps the OS retrieve processes to the main memory from the secondary memory in pages.

In this method, the main memory is divided into small fixed-size blocks of physical memory called frames.

The size of the frame and the page is supposed to be the same to help avoid external fragmentation. 

 

What is page protection?

The process of insertion of a bit known as Invalid\Valid bit is used to protect the paging process. 

The bits are associated with each page table entry and protect the specific page.

 

Advantages of paging.

 

The advantages of paging are as follows:

  1. Easy to use.
  2. No external fragmentation.
  3. Swapping is easy.

 

Disadvantages of paging.

 

The disadvantages of paging are as follows:

  1. Internal fragmentation.
  2. The memory management algorithm is complex.
  3. Consumes additional memory.
  4. Multi-level paging may cause memory reference overhead.

 

Example of paging:

Let us take an example where the main memory is 16KB and the frame size is 1KB. 

The main memory will be divided into 16 frames of 1KB each.

There are four processes, 4 KB each.

The processes will be divided into pages of 1KB each so that the OS can store one page in one frame.

 

At first, all the frames are empty so that they can store all the processes in a contiguous way. 

 

The process continues, and as the frames get empty, other processes are loaded and rest in the waiting queue. 

 

Reference

Paging in Operating System