# Virtual Memory - Calculating Page Table Size and Other Attributes

Im struggling to understand the answer to a question:

Consider a system with 2MiB physical memory and 4GiB virtual memory. Page size is 4KiB. If we choose to store seven information bits in each PTE, how big is the page table in bytes?

VPN contains $$log(\frac{2^{32}}{2^{12}})=20 bits$$

PPN contains $$log(\frac{2^{21}}{2^{12}})=9bits$$

9 bit PPN + 7 info bits = 16 bits per PTE

$$2^4$$ bit PTE * $$2^{20}$$ PTE's = $$2^{24}$$ bit page table, or $$2^{21}$$ bytes

Everything makes sense except the first line. I thought VPN bits $$= log(virtual memory space)$$ and that s 4GiB. Why are we dividing by the page size?

Im also lost on the next part, which asks: The page table starts off empty, then we make the following accesses: 0x00111999, 0x00234567, 0x00555FFF. If the page table begins at addres 0x20000000, at what address can we find the PTE for the first access? (Your answer should be in hex)

It gives the answer: 0x20000222. 0x00111999 has a VPN of 0x00111. Each PTE is 2 bytes, so 0x00111 * 2 = 0x00222. 0x20000000 + 0x00222 = 0x20000222.

I get that each PTE is 2 bytes, but why do we multiply by that?