Difference Between Monolithic kernel and Microkernel (μ-kernel)
A kernel is a software that forms a layer between the hardware and the operating system; it is divided into two main types, i.e. Monolithic kernel and MicroKernel; these types are mainly segregated based upon how they manage the process, along with this they also differ in the field of execution-style, size, speed, stability, inter-process communication, Extensibility, Mainitainibility, Debug, Security, etc., along with these differences its important to note that Monolithic kernel is much older than microkernels and are used in Linux while microKernels are used in Mac OS.
How does Kernel differ from an Operating System?
A kernel is part of an operating system, or you could say it the heart of an operating system. A kernel put together with useful applications becomes an operating system.
The important thing to note here is that an operating system consists of two parts:
- The kernel space (privileged mode)
- The userspace (unprivileged mode)
There are different types of kernel. The two main types are namely:
- Monolithic kernel
- MicroKernel
These kernel types are segregated based on how they manage a request from a process (also known as system calls) and resources. Monolithic kernels are much older than microkernels. Microkernels were discovered in the late 1980s.
Head to Head Comparison between Monolithic Kernel and MicroKernel (Infographics)
Below are the top 10 differences between Monolithic Kernel and MicroKernel
Key Differences between Monolithic Kernel and MicroKernel
Let us discuss some of the major differences between Monolithic Kernel vs MicroKernel.
- Space usage for execution: Monolithic kernel runs all the operating system instructions in the same address space, the kernel space, whereas Microkernel runs most system instructions in userspace and only a few in kernel space. In the case of microkernels, only important processes such as interprocess communication, scheduling, and memory management take place in kernel space.
- Size of the kernel: In Monolithic, since all system instructions are executed under kernel space, it increases the overall size of the kernel. This leads to an increase in the size of the operating system as well.
- Speed of Execution: Monolithic kernel provides better speed when compared to Microkernel as it runs all instructions under the same address space, which makes execution faster. In the case of Microkernel, the execution is slower due to additional messages passing between the different services running in different address spaces.
- Stability: If a process crashes in a monolithic kernel, it results in a system-wide halt. This is because every process running in the same address space is affected. Whereas in the case of a microkernel, due to the division of system operation between kernel and userspace, a service crash does not affect other services.
- Interprocess communication: Monolithic kernels make use of signals and sockets to achieve interprocess communication, whereas micro kernels make use of messaging queues to achieve the same.
- Extensibility: One of the major differences between the two kernel types is extensibility. For adding new features to a monolithic kernel, one would have to recompile the whole kernel. Recompilation would lead to more memory and time consumption. On the other hand, in the microkernel case, the services are isolated from each other as it implements messaging queues, making it more flexible to add or remove features.
- Maintainability: This is similar to extensibility. In order to fix any bugs in the monolithic kernel, one would have to recompile the entire kernel. Whereas that is not the case for microkernel.
- Debug: A crash in the privileged mode that is kernel space could corrupt the debugger itself. Due to this, it’s difficult to debug a monolithic kernel when compared to a microkernel.
- Security: Microkernels are more secure as compared to monolithic kernel since monolithic kernel runs their entire code in privileged mode, increasing the chances of a disaster.
Monolithic Kernel vs Microkernel Comparison Table
Let us discuss the topmost differences between Monolithic Kernel vs MicroKernel.
Basis of Comparison | Monolithic Kernel | MicroKernel |
Execution Style | All processes are executed under the kernel space in privileged mode. | Only the most important processes take place in the Kernel space. All other processes are executed in the user space. |
Size | Kernel size is bigger when compared to Microkernel. | Kernel size is smaller with respect to the monolithic kernel. |
Speed | It provides faster execution of processes. | Process execution is slower. |
Stability | A single process crash will cause the entire system to crash. | A single process crash will have no impact on other processes. |
Inter-Process Communication | Use signals and sockets to achieve interprocess communication. | Use messaging queues to achieve inter-process communication. |
Extensibility | Difficult to extend. | Easily extensible. |
Maintainability | Maintenance is more time and resource consuming. | Easily maintainable |
Debug | Harder to debug | Easier to debug |
Security | Less Secure. | More Secure |
Example | Linux | Mac OS |
Conclusion
Both kernel architectures come with their own set of pros and cons. Therefore there is not a straight forward answer as to which one is better and should be used. The kernel style should be selected based on the needs and requirements one has to meet. A few other types of kernels are the hybrid kernel, nanokernel, exokernel.
Recommended Articles
This has been a guide to Monolithic Kernel vs MicroKernel. Here we also discuss the key differences with infographics and comparison table. You can also go through our other suggested articles to learn more –