Paging in Operating System (OS): What is, Advantages, Example
โก Smart Summary
Paging is a memory management technique that stores processes in fixed-size pages and loads them into equally sized physical memory frames, letting the operating system use non-contiguous memory, avoid external fragmentation, and access data faster.

What is Paging in OS?
Paging is a storage mechanism that allows the OS to retrieve processes from 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 are called frames. The size of a frame is kept the same as that of a page to achieve 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.
Example of Paging in OS
To understand how pages map to frames, consider a simple example. If the main memory size is 16 KB and the frame size is 1 KB, then the main memory is divided into a 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 the operating system can store one page in one frame.
At the beginning of the process, all the frames remain empty, so all the pages of the processes are stored in a contiguous way.
In this example, you can see that A2 and A4 are moved to the waiting state after some time. Therefore, eight frames become empty, and other pages can be loaded into those empty blocks. The process A5, of size 8 pages (8 KB), is waiting in the ready queue.
Now there are eight non-contiguous frames available in the memory, and paging offers the flexibility of storing the process in different places. This allows the OS to load the pages of process A5 in place of A2 and A4.
What is Paging Protection?
The paging process is protected by inserting an additional bit called the valid/invalid bit. Memory protection in paging is achieved by associating protection bits with each page. These bits are associated with each page table entry and specify the protection allowed on the corresponding page.
Advantages of Paging
Here are the advantages of using the paging method:
- It is an easy-to-use memory management algorithm.
- There is no need for external fragmentation.
- Swapping is easy between equal-sized pages and page frames.
Disadvantages of Paging
Here are the drawbacks and cons of paging:
- It may cause internal fragmentation.
- Page tables consume additional memory.
- Multi-level paging may lead to memory reference overhead.
What is Segmentation?
Segmentation works almost similarly to paging. The only difference between the two is that segments are of variable length, whereas in the paging method, pages are always of fixed size.
A program segment includes the program’s main function, data structures, utility functions, and so on. The OS maintains a segment map table for all the processes. It also includes a list of free memory blocks, along with their size, segment numbers, and memory locations in the main memory or virtual memory.
Advantages of Segmentation
Here are the pros and benefits of segmentation:
- It offers protection within the segments.
- You can achieve sharing by having segments reference multiple processes.
- It does not cause internal fragmentation.
- Segment tables use less memory than paging.
Disadvantages of Segmentation
Here are the cons and drawbacks of segmentation:
- In the segmentation method, processes are loaded and removed from the main memory. Therefore, the free memory space is separated into small pieces, which may create a problem of external fragmentation.
- It is a costly memory management algorithm.


