Search code examples
memorymemory-managementvirtual-memoryvirtual-address-spacepage-tables

Virtual Memory To Physical Translation?


My book had the following image:

enter image description here

And a question of how many PTE's are there in L2 (or L1), the answer was 16 = 2^4 but why is that?

In the question it's given that each PTE size is 2 bytes so the answer should be 2^4/2 = 8 Since L2 index holds where we will point to. For example if it's 2 then it point to second half of the first PTE and not the second PTE.

What am I missing here?


Solution

  • You are overthinking. There are 4 bits used to index the L1 page table entry, so there are 2^4 possible values for this index and thus 2^4 possible page tables entries.

    The size of a page table entry is not relevant to this question. It is asking "how many", not "how large".