Monolithic kernel

from Wikipedia, the free encyclopedia

A monolithic kernel is a kernel in which not only functions for memory and process management and for communication between the processes, but also drivers for the hardware components and possibly other functions are directly integrated.

Structure of monolithic kernel, microkernel and hybrid kernel in comparison

No additional programs are required for the drivers - a speed advantage over a microkernel . However, such kernels are more prone to errors, since the part that has crashed cannot simply be restarted (as would theoretically be possible with a microkernel), but can even cause the entire system to crash. Despite this advantage, the microkernels that are ready for the market today are not more stable either.

The porting option is often implemented using a clever internal abstraction model that separates the hardware-specific functions from the general ones. In this way, a high degree of portability to other hardware platforms can be achieved even in a monolithic kernel architecture.

Example Linux

The Linux kernel developers recognized the weaknesses of the monolithic kernel early on and countered them by outsourcing functionalities to kernel modules . Thanks to the intensive use of kernel modules, also for functions close to the operating system, system functions can be loaded or reloaded, even during operation and during the development phase. You run in kernel mode again, so that Linux is still a monolithic kernel. This has the disadvantage that the protective mechanisms of modern processors only have limited effect on the kernel modules and a faulty module (especially faulty drivers from other providers) can crash the entire system.

System call in monolithic architecture

Calls to operating system functions from a user program require an interface ( API ). The system calls trigger entry into privileged mode (kernel mode). This are software interrupts or traps used. The application stores parameters and an identifier for the desired function in the main memory and generates a trap. The processor interrupts the application and starts the trap handler of the operating system. CPU control is passed from the application program ( user mode ) to the operating system ( kernel mode ). The requested function can now be started via the identifier. The arguments stored in the main memory are copied to the core address area and checked for consistency. The CPU processes the call. After completion, the called function copies either the result or the resulting error code to the memory area of ​​the application. Trap handling is completed and the processor is reset to the unprivileged state. Control is returned to the application.

advantages

  • Since the entire operating system functions run in kernel mode, the time-consuming and computationally intensive switching between the rings of the protected mode is kept to a minimum.
  • The reliability of important functions of the operating system (such as memory management) does not depend directly on the behavior of the user programs and does not have to be mapped into them (keyword: dynamic memory ).
  • There is no need for complex communication between the individual parts of the operating system. This avoids problems that arise when further dividing the operating system functionalities.

disadvantage

  • The exchange of functionalities must be carried out by a clever administration (for example by modules).
  • If changes are made, it is usually necessary to recompile the entire kernel. In some cases, however, there are also options to only compile individual modules .

Operating systems based on monolithic cores