Paging in OS | Difference between Page and Frame

By:   Last Updated: in: ,

Operating System: Q1.What is Paging in OS? Difference between Page and Frame? The procedure of paging and data structure involved in a paging scheme? (Operating System all notes) [ Topic= Paging in OS ]

Paging-in-Operating-System

Q1. What is Paging in OS? Difference between Page and Frame? The procedure of paging and data structure involved in a paging scheme?

Ans. Paging in OS: Paging is a method of non-contiguous memory allocation. In paging, the logical address space is divided into fixed-sized blocks known as Pages. The physical address space is also divided into fixed-size blocks known as Frames.
A page is mapped into a frame. The individual pages and frames are recognized by unique numbers known as the page number and frame number respectively.

The size of the page is equal to the size of a frame. A page number forms a part of the logical address and a frame number forms a part of a physical address.

Both page and frame size usually a power of 2 depending on the type of hardware. If a logical address consists of p number of digits, it means there are 2P addresses in the logical address space. Similarly, if a physical address consists of q number of digits, it means there are 2q addresses in the physical address space.
[ Topic= Paging in OS ]

Mapping of Pages to Frames: Paging in OS

A logical address consists of two parts such as page number and offset. If a logical address is p digits long and page size is 2n digits long, then the higher or left most p-q digits in a logical address denote the page number and the rest of the logical address denotes offset.

For Example: A logical address space can hold 213 addresses, it means a logical address is 13 bits long, or in other words, the logical address space is 8 KB. There are 8 pages in the logical address space that means the size of each page is 210 bits = 1 KB.

The size of the physical address space is 212 bit = 4 KB, which means the physical address is 12-bit long. In a logical address of 13-bits, the higher (13-10) = 3-bits denote the page number and the rest 10-bits denotes the offset. The logical address 011 1010101010 denotes page number 011 and the offset 1010101010.

A physical address consists of two parts such as frame number and offset. The offset is the same as it is in the corresponding logical address.
For Example: In the previous example, the offset 1010101010 of the logical address 011. 1010101010 is 10-bits long.

The physical address corresponding to this logical address can be 01 1010101010, where 01 is the frame number and 1010101010 is the offset. An operating system maintains a table to convert a logical address into its corresponding physical address. This table is called the Memory page table or Page table.
This method converting a logical address into its corresponding physical address is known as Address Translation.
[ Topic= Paging in OS ]

Hierarchical Page Tables: Paging in OS

With the increasing need for large applications, there is also a need for larger memory space in a computer. As a result, it becomes difficult to work with long memory addresses. In a paged memory system, the page table itself becomes very lengthy. The solution to this problem is hierarchical paging.outer and inner. The inner page table is similar to that of the single page table scenario. The outer page table stores the links for the inner page table. The logical address consists of three parts: outer page table entry, inner page table entry, and the offset.
Address-translation-in-paging-scheme-diagram
In hierarchical paging, the page table itself is paged. There are two page tables : outer and inner. The inner page table is similar to that of the single page table scenario. The outer page table stores the links for the inner page table. The logical address consists of three parts : outer page table entry, inner page table entry and the offset.
Hierarchical-Paging-Scheme-diagram
In the process of hierarchical paging, a logical address has been divided into three parts :X, Y, Z. The symbol, X represents the entry in the outer page table and symbol Y represents the entry in the inner page tables. The symbol Z represents the offset.

The Xth position in the outer page table stores the address of the inner page table associated with symbol X. The Yth position is searched in the inner page table and symbol Y contains the address of the frame containing the searched page.




[ Topic= Paging in OS ]
[ Topic= Paging in OS ]
[ Topic= Paging in OS ]


External Links:-

1. Paging in OS -  (click here)
2. Paging in OS -  (click here)

[ Topic= Paging in OS ]
[ Topic= Paging in OS ]

No comments:
Write comment