The blog provides study material for Computer Science(CS) aspirants. Mostly says "material nahi milta, padhun kahan se.", I think If you can not find content on the Internet, then you are not a CS student. Dedicated to (Prof. Rakesh Kumar, DCSA, K.U.Kurukshetra, HARYANA, INDIA)- "Ek teacher ka bahut jyada padhna, bahut jyada jaroori hota hai."
Saturday, 28 December 2013
Microkernel vs. Monolithic OS Architectures
Computer operating systems have been around for more than half a century so there is not much to add to the definition. Whether you are in the software industry or the academia, I assume you know what an operating system means but in few words an OS is the piece of software that sits between computing hardware and user applications. In this article, I am going to summarize and contrast some of the most popular operating systems architectures from a high level perspective.
Generally speaking, an operating system consists of two parts: a privileged mode called kernel space and unprivileged mode called user space. The separation is a need rather than an option otherwise process protection cannot be achieved. Depending on which processes run in what space, we can classify operating systems into three main architectures: Monolithic kernel, Microkernel and Hybrid or modular kernel operating systems. Let us now explore these architectures and see the good and bad about each one of them.
You can think of a monolithic kernel OS as a single large static binary file process running entirely in a single address space. Basic OS services such as process management, memory management, interrupt handling, IO communication, file system, device drivers, networking, etc all run in kernel space. Entire services are loaded on boot up and reside in memory and work is done using system calls. Linux is an example on a monolithic kernel based OS.
Monolithic Kernel Advantages
Generally speaking a monolithic OS kernel is faster due to small source and compiled code size. Less code means also less bugs and security issues.
Monolithic Kernel disadvantages
Monolithic OS being a single big pile of code has disadvantages. For example, making changes is not easy and testing takes more time. It is hard to maintain, patch or extend. Bug fixing or adding new features requires the compilation of the whole source code which is a time and resource consuming process.
The idea behind microkernel OS is to reduce the kernel to only basic process communication and IO control and let other system services run in user space just like any other normal processes. These services are called servers and kept separate and run in different address spaces. Contrary to monolithic OS where services are directly invoked, communication in a microkernel is done via message passing (inter process communication IPC). Mac OS and WinNT are two examples on microkernel OS architecture.
Here some advantages to the microkernel OS architecture…
Service separation has the advantage that if one service (called a server) fails others can still work so reliability is the primary feature. For example if a device driver crashes does not cause the entire system to crash. Only that driver need to be restarted rather than having the entire system die. This means more persistence as one server can be substituted with another. It also means maintenance is easier.
Different services are built into special modules which can be loaded or unloaded when needed. Patches can be tested separately then swapped to take over on a production instance.
Message passing allows independent communication and allows extensibility
The fact that there is no need to reboot the kernel implies rapid test and development.
Easy and faster integration with 3d party modules.
Here are some disadvantages to the microkernel approach…
Memory foot print is large
Potential performance loss (more software interfaces due to message passing)
Message passing bugs are not easy to fix
Process management is complex
The hybrid approach is derived from the best of both micro and monolithic kernel architectures. Instead of loading the whole thing into memory, core modules are loaded dynamically to memory on demand. One disadvantage is that a module may destabilize a running kernel.
The Linus Torvalds Andrew Tanenbaum Debate
Linus Torvalds the main guy behind Linux is a strong proponent of monolithic kernels while Andrew Tanenbaum the creator of Minix OS is a supporter of microkernel. Tanenbaum says that microkernel is a better design principle especially when reliability is of uttermost importance. According to Tanenbaum, reliability scores over performance gains because microkernels allow building self healing systems.
I will conclude this article by saying there is no OS architecture that is better than the other in the general sense. I think comparing monolithic operating system is like comparing two different types of transportation for example a car and a bus where each meets different needs.