2

Why is paging done only for user code (user space)? I know that the basic intuition behind paging is for managing larger logical address space in smaller physical main memory space. Won't the kernel size also be large? If the kernel code is large enough and the RAM size is small, then how is it managed? Please clarify.

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514

1 Answers1

3

Other than the fact that kernels tend to be small, as Yuval points out, you should also consider that they are often not relocatable code (in fact, address binding for kernels is done at compile-time) and so the memory they are allocated could not be moved or swapped-out in any case, not only for paging. Obviously there are also performance-related concerns, and one should consider handling exceptional cases too, like the code responsible for paging being swapped out.

Usually, memory limitations in operating systems are handled in different ways other than paging. For monolithic kernels, this means offering a loadable module system, while for microkernels the problem might not even apply, since their footprint on main memory is usually much lower than monolithic kernels (system services in microkernels are implemented as user-level processes).


Last but not least, enabling paging on kernel memory would defy one of its main definitions, being "[that] part of the operating system that is always resident in memory"1 ;-).

Acsor
  • 352
  • 1
  • 11