Where are Page tables stored

9

1

My question is "where are the page tables stored: in physical memory (RAM) or as some data structure in User space".

PS: What I have understood so far: A process memory layout has few segments ( Code/data/heap/stack etc). Since segmentation is not used nowadays, Paging is used and each segment would have many fixed size pages. Each segment will also have corresponding Virtual Address space (VADs)..these will point to Primary page tables, which would point to secondary page tables and finally pte's that would point to page frames in disk(?? i hope this was correct). So then if VAD's are in user space then do page tables also reside in user space or they are stored in RAM ?

RootPhoenix

Posted 2014-03-31T02:23:45.373

Reputation: 193

Answers

5

Page tables are handled by the kernel, via kernel internal data structures. But the architecture determines most of the format of those tables. Userland does not have any access to them.

vonbrand

Posted 2014-03-31T02:23:45.373

Reputation: 2 083

@vonbrand Anderson is correct. On x86 and x64 only the top-level page table for each process (which occupies one page or less) must be permanently resident. – Jamie Hanrahan – 2019-02-07T05:02:26.750

1Ok! just for additional info..ultimately this data structure ( in kernel space) and other kernel related stuff would be placed in RAM right...at some secure address space ?. – RootPhoenix – 2014-03-31T03:21:35.997

2Sorry, yes. They are placed in RAM. They can't be shipped out to disk (paged), as they are needed to find out if a page is present in RAM. The operating system manages virtual memory on the user processes' behalf, and is responsible to make sure no part of a page table is even included in a process' virtual memory space. – vonbrand – 2014-03-31T03:28:29.417

Please check my answer. @vonbrand – Anderson – 2014-05-09T06:45:46.777

4

Quote from wiki - page table

It was mentioned that creating a page table structure that contained mappings for every virtual page in the virtual address space could end up being wasteful. But, we can get around the excessive space concerns by putting the page table in virtual memory, and letting the virtual memory system manage the memory for the page table.

However, part of this linear page table structure must always stay resident in physical memory, in order to prevent against circular page faults, that look for a key part of the page table that is not present in the page table, which is not present in the page table, etc.

Anderson

Posted 2014-03-31T02:23:45.373

Reputation: 141