19
votes

This might be a silly question but it just popped up in my mind. All the text about process address space and virtual memory layout mentions that the process address space has space reserved for kernel. For e.g. on 32 bit systems the process address space is 4GB of which 1 GB is reserved for kernel in Linux (Might be different on other OS).

I am just wondering why kernel is said to be in the process address space when a process cannot address the kernel directly. Why don't we say that the kernel has a separate address space than a process and why can't we have a different page table for kernel itself which is separate from the page tables of the processes?

1
Can you identify one or more specific URLs which describe how the process address space has space reserved for the kernel? It certainly isn't universal; I'm tolerably certain that there are 32-bit systems (not necessarily Linux-based) using more than 3 GiB of shared memory in a single process, which doesn't leave 1 GiB for the kernel.Jonathan Leffler
I was just giving an example that some space is reserved for kernel. The specifics are not as important to the question.vjain27

1 Answers

18
votes

When the process makes a system call, we don't need to switch the page tables (from process address space page table to kernel address space page table) for servicing the system call (which should be done only in kernel mode). This is said to be that the kernel is running in the process context.

Some kernel events which won't run in process context will load the page tables only for kernel.

Got it ?