Site icon DataFlair

Paging in Operating System

Paging in OS

FREE Online Courses: Dive into Knowledge for Free. Learn More!

A memory management scheme and storage mechanism that eliminates the need for contiguous physical memory allocation is known as paging. The physical address space of a process is non-contiguous. Paging allows an OS to transfer processes from the secondary storage to the main memory. These processes are transformed in the form of pages.

This is a logical concept that ensures faster data access. Some terms involved in paging are:

Paging Technique in OS

Paging technique is the mapping done from virtual address to physical address by the MMU (a hardware device). The Physical Address Space is divided into multiple fixed-size blocks. These blocks are called frames. Whereas, Logical address Space is divided into fixed-size pages. Here the size of a page is equal to the size of a frame which allows maximum utilization of the main memory and avoids external fragmentation.

The address generated by a CPU is divided into:

1. Page number(p): This is the number of bits that represent the pages in Logical Address Space or Page number.

2. Page offset(d): This is the number of bits that represent a particular word in a page or the page size of Logical Address Space or page offset.

We can divide Physical Address into:

1. Frame number(f): This is the number of bits that represent the frame of Physical Address Space or Frame number.

2. Frame offset(d): This is the number of bits that represent a particular word in a frame or frame size of Physical Address Space or frame offset.

Hardware implementation of Page Table

Dedicated registers help in the hardware implementation of a page table. But this is satisfactory until the page table is small. For larger page tables we use a translation Look-aside buffer (TLB). It is a small and fast look up hardware cache.

Features of TLB

What is Paging Protection?

Insertion of an additional bit – a Valid/Invalid bit, can help protect a paging process. Whereas, we can achieve Paging Memory protection by associating protection bits with each page.

Advantages of Paging in OS

Following are the advantages of Paging in OS:

Disadvantages of Paging in OS

Following are the disadvantages of paging in Operating System:

Segmentation in OS

Segmentation is similar to paging, except that the length of segments is variable and pages have a fixed size. The segment of a program comprises the program’s main function, data structures, utility functions, etc.

All this information about processes is maintained in the form of a segment map table by the OS. This table also includes a list of free memory blocks, their sizes, segment numbers, and their memory locations in the main memory or virtual memory.

Advantages of Segmentation

Following are the advantages of segmentation:

Disadvantages of Segmentation

Following are the disadvantages of segmentation:

Summary

A memory management scheme and storage mechanism that eliminates the need for contiguous physical memory allocation is known as paging. Paging technique is the mapping done from virtual address to physical address by the MMU (a hardware device). Segmentation is similar to paging, except that the length of segments is variable and pages have a fixed size.

Exit mobile version