Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Linux called a monolithic kernel?

People also ask

Is the Linux kernel a monolithic kernel?

Different Types of Kernels In general, most kernels fall into one of three types: monolithic, microkernel, and hybrid. Linux is a monolithic kernel while OS X (XNU) and Windows 7 use hybrid kernels.

What is the meaning of monolithic kernel?

A monolithic kernel is an operating system architecture where the entire operating system is working in kernel space. The monolithic model differs from other operating system architectures (such as the microkernel architecture) in that it alone defines a high-level virtual interface over computer hardware.

Is Linux kernel monolithic or microkernel?

The other one is that it is a single large process running entirely in a single address space. It is a single static binary file. Examples of some Monolithic Kernel-based OSs are Unix, Linux, Open VMS, XTS-400, z/TPF.

What is the difference between kernel and monolithic kernel?

A microkernel is a kernel type that implements an operating system by providing methods, including low-level address space management, IPC, and thread management. On the other hand, a monolithic kernel is a type of kernel in which the complete OS runs in the kernel space.


A monolithic kernel is a kernel where all services (file system, VFS, device drivers, etc) as well as core functionality (scheduling, memory allocation, etc.) are a tight knit group sharing the same space. This directly opposes a microkernel.

A microkernel prefers an approach where core functionality is isolated from system services and device drivers (which are basically just system services). For instance, VFS (virtual file system) and block device file systems (i.e. minixfs) are separate processes that run outside of the kernel's space, using IPC to communicate with the kernel, other services and user processes. In short, if it's a module in Linux, it's a service in a microkernel, indicating an isolated process.

Do not confuse the term modular kernel to be anything but monolithic. Some monolithic kernels can be compiled to be modular (e.g Linux), what matters is that the module is inserted to and runs from the same space that handles core functionality (kernel space).

The advantage to a microkernel is that any failed service can be easily restarted, for instance, there is no kernel halt if the root file system throws an abort. This can also be seen as a disadvantage, though, because it can hide pretty critical bugs (or make them seem not-so-critical, because the problem seems to continuously fix itself). It's seen as a big advantage in scenarios where you simply can't conveniently fix something once it has been deployed.

The disadvantage to a microkernel is that asynchronous IPC messaging can become very difficult to debug, especially if fibrils are implemented. Additionally, just tracking down a FS/write issue means examining the user space process, the block device service, VFS service, file system service and (possibly) the PCI service. If you get a blank on that, its time to look at the IPC service. This is often easier in a monolithic kernel. GNU Hurd suffers from these debugging problems (reference). I'm not even going to go into checkpointing when dealing with complex message queues. Microkernels are not for the faint of heart.

The shortest path to a working, stable kernel is the monolithic approach. Either approach can offer a POSIX interface, where the design of the kernel becomes of little interest to someone simply wanting to write code to run on any given design.

I use Linux (monolithic) in production. However, most of my learning, hacking or tinkering with kernel development goes into a microkernel, specifically HelenOS.

Edit

If you got this far through my very long-winded answer, you will probably have some fun reading the 'Great Torvalds-Tanenbaum debate on kernel design'. It's even funnier to read in 2013, more than 20 years after it transpired. The funniest part was Linus' signature in one of the last messages:

Linus "my first, and hopefully last flamefest" Torvalds

Obviously, that did not come true any more than Tanenbaum's prediction that x86 would soon be obsolete.

NB:

When I say "Minix", I do not imply Minix 3. Additionally, when I mention The HURD, I am referencing (mostly) the Mach microkernel. It is not my intent to disparage the recent work of others.


Monolithic kernel means that the whole operating system runs in kernel mode (i.e. highly privileged by the hardware). That is, no part of the OS runs in user mode (lower privilege). Only applications on top of the OS run in user mode.

In non-monolithic kernel operating systems, such as Windows, a large part of the OS itself runs in user mode.

In either case, the OS can be highly modular.


;tl-dr - No, Linux is always monolithic.

Linux modules may mean modular in some sense. As others have noted monolithic is usually representing a microkernel versus monolithic kernel. A traditional microkernel only has these features,

  1. Scheduling
  2. Memory management
  3. Inter-process communications

There are no hardware drivers, protocol stacks, filesystems, suspend/resume, clock management, etc in the main kernel. These things are identical to any user task (although they may have different privileges via the MMU/scheduler).


Tanenbaum's predictions

  1. Microkernels are the future
  2. x86 will die out and RISC architectures will dominate the market
  3. (5 years from then) everyone will be running a free GNU OS

PC and server programmers may laugh, but two and three are certainly true for the majority of cell phones in existence. Tanenbaum would be right on all accounts if BlackBerry QNX was a success.

Also, many L1-hypervisors have a micro-kernel underneath. This is because a hyper-visor usually doesn't do much beside context switch.

Apparently three predicts the success of Linux. ;-)


An argument for microkernels is that all of the monolithic sub-systems need to synchronize multiple values at one time. In order to do this, they must use locks and will suffer from Amdahl's law when extended to parallel architectures. The counter is that microkernels result in lots of IPC messages.

A major development is the use of lock-free programming to avoid contention in a monolithic kernel. This avoids the locking in a monolithic kernel while also reducing IPC overhead. Recently all CPUs have been extending their ISA to include better primitives for lock-free algorithms. So Linux will probably remain a monolithic kernel for some time.


From Wikipedia:

A monolithic kernel is a kernel architecture where the entire operating system is working in the kernel space and alone as supervisor mode. In difference with other architectures, the monolithic kernel defines alone a high-level virtual interface over computer hardware, with a set of primitives or system calls to implement all operating system services such as process management, concurrency, and memory management itself and one or more device drivers as modules.

Recent versions of Windows on the other hand use a Hybrid kernel.

A hybrid kernel is a kernel architecture based on combining aspects of microkernel and monolithic kernel architectures used in computer operating systems. The category is controversial due to the similarity to monolithic kernel; the term has been dismissed by some as simple marketing. The traditional kernel categories are monolithic kernels and microkernels (with nanokernels and exokernels seen as more extreme versions of microkernels).