Q78: Kernel vs User memory

Question 78: Kernel also requires memory for storing its code and various other segments, processes specific data etc. How should this kernel memory be implemented?

  1. Same as user process i.e. Virtual memory because kernel is just like another process.
  2. Same as user process i.e. Virtual memory because VM system provides easy security and sharing mechanism.
  3. It should not be implemented as virtual memory because kernel pages shouldn’t be swapped out as they are critical to system’s working.
  4. It should not be implemented as virtual memory because kernel pages shouldn’t be intermingled with processes pages. It requires separate contiguous memory.

Solution: Kernel pages perform critical functions and shouldn’t be swapped out. Example, page fault handler is part of kernel, if the code for it is not itself present in memory and a page fault occurs for some user process then there is no way to deal with it. Hence, the correct answer is option 3.