Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Hashed Page Tables in Operating System

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The following are the most common techniques for structuring the page tableHierarchical Paging, Hashed Page Tables, and Inverted Page Tables. Let us explore more about Hashed Page Tables and their working in this article. 

Hashed Page Tables: In hashed page tables, the virtual page number in the virtual address is hashed into the hash table. They are used to handle address spaces higher than 32 bits. Each entry in the hash table has a linked list of elements hashing to the same location (to avoid collisions – as we can get the same value of a hash function for different page numbers). The hash value is the virtual page number. The Virtual Page Number is all the bits that are not a part of the page offset. For each element in the hash table, there are three fields –

  1. Virtual Page Number (which is the hash value).
  2. Value of the mapped page frame.
  3. A pointer to the next element in the linked list.

 

Hashed Page Table : The virtual page number is compared with field 1 in the first element of the linked list. If it matches, the corresponding page frame (field 2) is used to form the desired physical address. Otherwise, subsequent entries in the linked list are checked until the virtual page number matches. To make this algorithm suitable for 64-bit address spaces also, clustered page tables are used. Clustered Page Tables are similar to hashed page tables except that each entry in the hash table refers to many pages rather than one single page (as in a hashed page table). Hence, a single entry of a clustered page table can store the mappings for multiple physical page frames. Clustered page tables are specifically useful for sparse address spaces, where memory references are scattered throughout the address space (non-contiguous).

Hashed page tables are a type of data structure used by operating systems to efficiently manage memory mappings between virtual and physical memory addresses. 

Some characteristics of hashed page tables:

  1. Hashed page tables use a hash function to map virtual page numbers to physical page frame numbers. This allows for faster lookups compared to traditional page tables, which use a linear search to find the corresponding physical page frame.
  2. Hashed page tables can reduce the size of the page table by only storing entries for pages that are currently in use. This is in contrast to traditional page tables, which must store an entry for every possible virtual page number.
  3. Hashed page tables are more resistant to certain types of attacks, such as page table overflow attacks, because they only store entries for pages that are currently in use.
  4. Hashed page tables can be more complex to implement than traditional page tables, as they require the use of a hash function and collision resolution strategy.
  5. Hashed page tables can be used in conjunction with other page table structures, such as hierarchical page tables, to provide a hybrid approach to memory management.

Overall, hashed page tables offer a more efficient and secure way of managing memory mappings in an operating system, but they require more complex implementation compared to traditional page tables.

My Personal Notes arrow_drop_up
Last Updated : 14 Mar, 2023
Like Article
Save Article
Similar Reads