When there is a process switch, and the page tables and page directory of the new process has to be used, from where does the kernel come to know about the location of the page directory for the new process ?

I know that the page directory of the new process is stored in physical memory. But how does the kernel know where to find it ?

有帮助吗?

解决方案

Generally a kernel keeps a structure of state describing each process on the system. Somewhere in that structure there will be the address of the process's 'root' page table. On x86 machines this needs to be stored in the CR3 register to switch to a new page table. Sometimes this register is implicitly saved and restored as a side-effect of a larger operation that saves/restores a bunch of CPU state, or sometimes this value is explicitly managed by the kernel.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top