operating-systemvirtual-memory

What exactly is the "Kernel Master Page Global Directory"?


I once heard my OS lecturer discuss a data structure in the kernel space called the "Kernel Master Page Global Directory" (KMPGD for short), which is used to manage kernel pages alongside the page table of a process. However, I didn't quite understand:

Why would we need a separate data structure to manage kernel space pages?

I also tried searching the internet for information about this data structure, but I haven't found any resources discussing it. Mainly the answer is preferred to be based on the x86 and/or x86_64 architecture.


Solution

  • Academics like to make the simple confusing. All processes share the same kernel address space. Each process has its own user address space. At any given time the entire available address space for a process is the kernel address space plus the processes's own address space.

    How that is arranged is entirely system specific. Page tables take on many forms. The simplest is a linear page table. In that way, you could have a system register (whose value never change) that points to the kernel page table and another system register that points to the user space page table for the current process, which changes with each context switch.

    You need to keep the kernel parts of the page table separate from the part for the current process because the former is fixed and the latter changes as the current process changes.