Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does every process have its own page table?

Does every process have its own page table or does it simply add it's page entries into one big page table?

like image 979
Steven Avatar asked Dec 07 '10 20:12

Steven


People also ask

Does every process has a page table?

Yes every process has its own pagetables. They might be shared with the parent process(copy on write) or with other processes(shared memory).

Is there only one page table?

There is only one kernel page table (including page directory) but each process would need a separate one to be able to address virtual space.

Can two processes share a page table?

If a process calls clone() to create a new process, but requests that the two processes share the same page table, then you effectively have a thread as both processes see the same underlying physical memory. You can also see now how copy on write is done.

Does the kernel have its own page table?

And yes, to your question, entries from #768 to #1023 in pgd are the same and are duplicated by each process. But this is only a very small part. The second level page table for kernel are still shared across all processes.


2 Answers

Yes every process has its own pagetables. They might be shared with the parent process(copy on write) or with other processes(shared memory). But in general every process has its own.

like image 162
Bernd Avatar answered Sep 24 '22 12:09

Bernd


Yes, unless you use an inverted page table see this answer. Because an inverted page table is global, each entry must also contain which process it belongs to.

like image 42
EthanP Avatar answered Sep 24 '22 12:09

EthanP