5

i know that page tables are stored in memory , and each process has its own table , but each table has entries as the number of virtual pages in virtual memory so how can every process has a table and each table resides in main memory besides , the number of entries in each table is larger than the number of physical pages in main memory ...can someone explain that to me i'm very confused , Thanks in Advance.

1
  • 2
    I've seen this more than 1 time and I haven't found what im looking for...
    – SE Student
    Jun 20, 2014 at 7:43

1 Answer 1

17

Typically, page tables are said to be stored in the kernel-owned physical memory. However page tables can get awfully big since each process have their own page tables (unless the OS uses inverted paging scheme). For even a 32 bit address space with a typical 4KB page size, we shall require a 20 Bit virtual page number and a 12 bit offset. A 20 bit VPN(Virtual Page Number) implies that there would be 2^20 translations. Even if each translation i.e the Page Table entry requires 4 Bytes of memory, it amounts to 4x(2^20)= 4MB of memory, all just of address translations, which is awful.

Hence modern OSes place such large page tables in virtual kernel memory which is the Hard Disk, and swaps them to the physical memory whenever required. Thus page table is virtualized the same way each page is virtualized.

I would suggest you to go through this wonderful and easy book to get a clear under standing of Memory Virtualization and Paging related concepts: http://pages.cs.wisc.edu/~remzi/OSTEP.

3
  • 2
    Looks decent that book... Reading now~
    – Kindred
    Dec 10, 2018 at 1:19
  • 1
    The pertaining sections in the book are 20.5 and 23. They relate to VAX/VMS. It is unclear if this applies to Linux.
    – Michaël
    Aug 4, 2020 at 16:06
  • However, some basic/key page tables must always stay resident in physical memory, in order to prevent circular page table fault.
    – Bruce
    Mar 3, 2022 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.