You are on page 1of 6

1.

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 Space = 256MB


● Logical Address Space = 4GB
● Frame Size = 4KB
● Page Table Entry = 2B

Here, Byte addressable memory 4k (Frame Size) can be


represented with 12 bits. In the same way 256MB (Physical
Address Space) can be represented with 28 bits. So, Frame No
can be represented with (28-12) = 16 bits.

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

Given, Logical Address Space = 4GB can be represented with 32


bits. So, Number of pages = 32 - 16 = 20.

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.

In order to fix this problem, we will apply multi level paging. We


will divide the page table into multiple pages. By dividing the page
table size by 4KB (each memory frame size) we get 29 = 512
which will be the number of entries for the outer page table. In the
outer page table each entry will still hold 2B data. Now the size of
the outer page table will be 29 * 2B = 1KB which is lower than the
4KB. So, now we can store the outer page table in a single frame
in main memory.

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.

Logical Address (32 bit)


P1 P2 d
9 bit 11 bit 12 bit

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.

In conclusion, we can say that multilevel paging is like creating


index of indexes of a book.
2. Memory Segmentation :

You might also like