Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does kernel add kernel master page table to process's page table?

Why does kernel add kernel master page table to process's page table?it can share with all process, If Master page table change at any point then kernel need to update all process's page table also?


1 Answers

The kernel part of the page table is required for each process to be able to access kernel memory (eg. to handle an interrupt or system call).

Whether the kernel is actually required to update the page mappings for all processes individually depends on how the page mapping is done.

For x86-based systems in protected mode, the page mapping is done using a page directory containing references to a set of page tables, which in turn are used to manage each single page in a specific memory block.
So, a change of a specific page must be taken out into a specific page table. But because a page table is referenced using the process-specific page directory, there is no need to duplicate the kernel page tables for each process, ie. all process-specific page directories can reference the same set of kernel page tables.
Thus, a change to the kernel page tables does not need to be duplicated to each process, because it already is (due to that referencing via the page directory) and thus only the processors' memory address lookup table must be changed so that the new mapping is loaded from memory.
Because this part is highly dependent on the actual hardware in use, this might not apply generally, ie. it is theoretically possible that there exists a processor for which the kernel would be required to duplicate kernel page changes to each process.

like image 129
Abrixas2 Avatar answered May 22 '26 07:05

Abrixas2