Structure of Page Table in Operating Systems
Structure of Page Table in Operating Systems
In this tutorial, we will cover some of the most common techniques used for structuring the
Page table.
The data structure that is used by the virtual memory system in the operating system of a
computer in order to store the mapping between physical and logical addresses is commonly
known as Page Table.
As we had already told you that the logical address that is generated by the CPU is translated
into the physical address with the help of the page table.
• Thus page table mainly provides the corresponding frame number (base address of the
frame) where that page is stored in the main memory.
The above diagram shows the paging model of Physical and logical memory.
1. Hierarchical Paging
2. Hashed Page Tables
3. Inverted Page Tables
Hierarchical Paging
Another name for Hierarchical Paging is multilevel paging.
• There might be a case where the page table is too big to fit in a contiguous space, so
we may have a hierarchy with several levels.
• In this type of Paging the logical address space is broke up into Multiple page tables.
• Hierarchical Paging is one of the simplest techniques and for this purpose, a two-level
page table and three-level page table can be used.
Consider a system having 32-bit logical address space and a page size of 1 KB and it is
further divided into:
As we page the Page table, the page number is further divided into :
P2 indicates the displacement within the page of the Inner page Table.
As address translation works from outer page table inward so is known as forward-mapped
Page Table.
Below given figure below shows the Address Translation scheme for a two-level page table
For a system with 64-bit logical address space, a two-level paging scheme is not appropriate.
Let us suppose that the page size, in this case, is 4KB.If in this case, we will use the two-page
level scheme then the addresses will look like this:
Thus in order to avoid such a large table, there is a solution and that is to divide the outer
page table, and then it will result in a Three-level page table:
Given below figure shows the address translation scheme of the Hashed Page Table:
The Virtual Page numbers are compared in this chain searching for a match; if the match is
found then the corresponding physical frame is extracted.
In this scheme, a variation for 64-bit address space commonly uses clustered page tables.
• These are similar to hashed tables but here each entry refers to several pages (that is
16) rather than 1.
• Mainly used for sparse address spaces where memory references are non-contiguous
and scattered
• There is one entry for each virtual page number and a real page of memory
• And the entry mainly consists of the virtual address of the page stored in that real
memory location along with the information about the process that owns the page.
• Though this technique decreases the memory that is needed to store each page table;
but it also increases the time that is needed to search the table whenever a page
reference occurs.
Given below figure shows the address translation scheme of the Inverted Page Table:
In this, we need to keep the track of process id of each entry, because many processes may
have the same logical addresses.
Also, many entries can map into the same index in the page table after going through the hash
function. Thus chaining is used in order to handle this.