0
votes

I am given a system with 64-bit virtual address space. with page size of 2KB. Also it is given that the physical memory is of the size 16GB.

I need to calculate the following parameters: number of page entries (number of lines in the page table), how many bits are needed for the page offset, how many bits are needed for the virtual page number (VPN), and how many bits are needed for the physical page number (PPN).

So, first I concluded that the size of the virtual memory is 2^64 bytes, and that means there are 2^53 entries in the page table.

From the size of a page I concluded that 11 bits are needed for the page offset.

From here I'm not so sure.

Since each virtual address is of the size 64 it, then the VPN is of the size 64 - 11 = 53 bits.

Since the physical memory is of the size 2^34 bytes, then a physical address if of 34 bits. Which means the PPN is of the size 34 - 11 = 23 bits.

Are my calculations correct? and also is my thinking correct?

Help would be appreciated

1
Your calculations look good to me. - Hadi Brais
Okay, Thanks! I just want to clarify one more thing: is the size of the vpn in bits always the same as the number of entries in the page table? (When the table is not multi level) - Gabi G
Not necessarily, especially when TLB misses are handled by the OS, not by the hardware. The page table can be designed so that multiple VPNs may map to the same entry in the page table. An entry would then contain the VPN that it maps. Essentially the table would work similarly to a direct mapped cache. But if a TLB miss is handled by the hardware, then typically yes, each entry in the page table would correspond to a unique VPN. - Hadi Brais

1 Answers

1
votes

Some of your results are correct. PPN is 23 bits, VPN is 53 bits. But all the stuff concerning the page tables is wrong.

A page table contains a set of physical page adresses. Hence as a PPN is 23 bits, one needs 4 bytes (the power of 2 above 23) to describe a PP. If pages are 2k bytes, you can store 2^9 PP adresses par page.

As VPN are 53bits, and each table can resolve 9 bits, the translation can be done by 6 consecutive tables. If you are not familiar with multilevel pages, there are many good tuturials. See for instance https://en.wikipedia.org/wiki/Page_table

What is certain is that the PT size is NOT 2^53!! First because 2^55 is an insane amount of memory (~10^16). And second, because the total number of PP is 2^23, so why use a table 1 billion times larger... (and this is why we use multilevel page tables)