Professional Documents
Culture Documents
Multilevel Paging :
Multilevel Paging is a paging scheme that is made up of two or
more levels of page tables in a hierarchical manner. It is also
called hierarchical paging. The entries of the level 1 page table
are pointers to a level 2 page table and entries of the level 2 page
tables are pointers to a level 3 page table and so on.
When the size of the page table is greater than the frame size,
then the page table cannot be stored in a single frame in the main
memory in such a case. In such cases, we need the Multilevel
paging technique.
Example :
Physical Address
Frame No Offset
16 12
Main Memory
4KB
4KB
4KB
…
…
…
4KB
Here, each frame has a size of 4KB and there are a total of 216
frames. If we multiply 4KB with 216 we get 256MB which is the
physical address space size.
Logical Address
Page No Offset
20 12
Process
4KB
4KB
4KB
…
…
…
4KB
So, if our total process size is 4GB and we divide the process into
pages of which each are of 4KB in size then our total number of
pages will be 220 = 1 million pages. Now to store these 1 million
pages we will first have to create page table with the help of which
we will determine which page is stored in which location of the
main memory.
Now, the total entries in the page table will be equal to the total
number of pages of the process which is 220 = 1 million entries.
The size of a single page is 4KB but we will only keep the
mandatory part in page table which is the frame number in
memory for a page. We can see, total number of frames is 16
meaning a page table entry will hold 16 bits or 2B data. The size
of page table will be = 220 * 2B = 2MB. Now we will store this 2MB
page table into a frame of main memory.
Page Table
2B
2B
2B
…
…
…
2B
But we can see that each frame of the main memory can only
hold 4KB of data which is less than that of page table size (2MB).
So, we are unable to store the data in main memory this way.
So, now the logical address will contain 3 data. The outer page no
can be represented with 9 bits.
Logical Address
Page No Offset
9 11 12
The outer page table will hold the starting address of an inner
page table page. Each page of the inner table will hold 4KB/2B =
211. Of which a particular entry will hold the address of the frame
consisting the data which will then be figured out using the offset.
Here, the 9 bit will take us to the outer page table to the page we
are looking for. Now with the address we will go to the page of
page table where we will find the particular page out of 211 entries
where we will get the address of the frame in main memory. Thus
we will access the desired data from the main memory.