Linux Kernels

GEEKS!!

Few days back one student ask about types of Linux kernels as it was asked in some interview.  That guy had completed his RHCE Training.

Though I had explained him. But thought of sharing it with you all, in detail. Will try to put points in points (brief).

Taking words from wikipedia and slightly modifying it, to make it more easy.

Kernel is the core of any OS. Its actually a computer program that manages input/output requests from software and translates them into data processing instructions for the CPU and other electronic components of a computer. 

Interestingly !!!

An operating system kernel is not strictly needed to run a computer. Programs can be directly loaded and executed on the “bare metal” machine, provided that the authors of those programs are willing to do without any hardware abstraction or operating system support. This was the normal operating method of many early computers, which were reset and reloaded between the running of different programs. The “bare metal” approach is still used today on many video game consoles and embedded systems, but in general, newer systems use kernels and operating systems.

When you run a computer program (called process) it makes requests of the kernel, the request is called a system call. Each process operates as if it were the only process running. The kernel completely insulates a program from the implementation details of physical memory layout, peripheral access, networking, etc.

We can differentiate between kernel types by understanding how the kernel manage system calls and resources.

monolithic kernel executes all the operating system instructions in the same address space (kernel space) to improve the performance of the system. This approach provides rich and powerful hardware access. A monolithic kernel is one single program that contains all of the code necessary to perform every kernel related task. Modern monolithic kernels, such as those of Linux, fall into the category of Unix-like operating systems, feature the ability to load modules at runtime, thereby allowing easy extension of the kernel’s capabilities as required, while helping to minimize the amount of code running in kernel space. These types of kernels consist of the core functions of the operating system and the device drivers with the ability to load modules at runtime. (So Linux combines the best of monolithic and modular approach).

Whereas, a microkernel runs most of the operating system’s background process in user space, to make the operating system more modular and, therefore, easier to maintain.

Hybrid or ‪Modular Kernel – Operating systems such as Microsoft Windows NT, 2000, XP, Vista, 7 and 8. Apple Inc’s own Mac OS X uses a hybrid kernel called XNU. These types of kernels are extensions of micro kernels with some properties of monolithic kernels. Unlike monolithic kernels, these types of kernels are unable to load modules at runtime on their own. Hybrid kernels are micro kernels that have some “non-essential” code in kernel-space in order for the code to run more quickly than it would were it to be in user-space. Hybrid kernels are a compromise between the monolithic and microkernel designs.

Many traditionally monolithic kernels are now at least adding (if not actively exploiting) the module capability. The most well known of these kernels is the #Linux kernel. The modular kernel essentially can have parts of it that are built into the core kernel binary or binaries that load into memory on demand.

Lets put it in simple words:

Monolithic Kernel: 

Kernel Image = (Kernel Core+Kernel Services). 

When system boots up entire services are loaded and resides in memory.

Example: Windows and Unix.

Micro Kernel : 

Kernel Image = Kernel Core. 

Services are build in to special modules which can be loaded and unloaded as per need.

Modular Kernel: 

Kernel Image = (Kernel core + IPC service modules +Memory module +Process Management module). 

All other modules are loadable kernel modules.

Example: Linux kernel

There are other types of kernel also, like nanokernel & exokernel which I am not discussing here.

Kernel Types explained

Kernel Types explained

Advertisements