0
$\begingroup$

The advantage of a multi-level page table is that we can swap the inner-level page tables to some secondary storage. If however we want quick access to the whole address space, we have to keep all page tables in memory. Then there are no savings.

However, imagine that not the innermost page-table pointed to the final frame, but that each page table contributes a bit to get the final address. In other words, we divide each virtual address into sections and map these instead.

I.e. we have a virtual address 1011 that maps to 1110 using a 2-level page table. Then the outer-level page table maps 10 -> 11 and the 2nd-level page table with index 3 (from binary 11) maps 11 -> 10. Together we get the address 1110.

I was learning about multi-level page tables and they were quite confusing to me. This is the way I initially imagined they worked. Now obviously, this restricts how we can map the virtual address space to the physical address space, i.e. pages with the same prefix will have physical locations close to each other. However, I don't see the problem with this approach.

Why is this approach not used if it can save memory? Or do I have some error in my thinking?

$\endgroup$
  • $\begingroup$ Your method actually takes up more space. Try calculating the memory required to store your page table vs multi level page tables for a 16 bit address space. Plus, page tables don't just contain mapping information. They also contain metadata about the page they point to, like if the page is read-only, executable and so on. Your method is more memory intensive than multi-level page tables without the metadata. $\endgroup$ – RandomPerfectHashFunction Feb 11 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.