Kernel (computer science)

A **kernel** is the central part of an operating system. It manages the operations of the computer and the hardware, most notably memory and CPU time. Kernels also provide services which programs can use through system calls. 

There are five types of kernels: 
* A micro kernel - A kernel which only contains the basic functionality;
* A monolithic kernel - A kernel which contains many device drivers. The Linux kernel is an example of a monolithic kernel.
*Hybrid Kernel - The Microsoft Windows NT kernel is an example of a hybrid kernel.
*Exokernel
*Nanokernel

A typical computer user never interacts directly with the kernel. It runs behind the scenes and cannot be seen, except for the text logs that it prints.

## Operations of kernel 
The kernel is the most fundamental part of an operating system. It can  be thought of as the program which controls all other programs on the computer. When the computer starts, it goes through some initialization (booting) functions, such as checking memory. It is responsible for assigning and unassigning memory space which allows software to run.

The kernel provides services so programs can request the use of the network card, the disk or other pieces of hardware. The kernel forwards the request to special programs called device drivers which control the hardware. It also manages the file system and sets interrupts for the CPU to enable multitasking. Many kernels are also responsible for ensuring that faulty programs do not interfere with the operation of others by denying access to memory that has not been allocated to them and restricting the amount of CPU time they can consume.
It is the heart of the operating system.

## Micro kernels and monolithic kernels 
Operating systems commonly use monolithic kernels. In Linux, for example, device drivers are often part of a kernel (specifically Loadable Kernel Modules). When a device is needed, its extension is loaded and 'joined' onto the kernel making the kernel larger. Monolithic kernels can cause trouble when one of these drivers is faulty, such as if a beta driver is downloaded. Because it is part of the kernel the faulty driver can override the mechanisms that deal with faulty programs (see above). This can mean that the kernel, and thus the entire computer, can cease to function. If there are too many devices, the kernel can also run out of memory causing a system crash or making the computer very slow.

Microkernels are a way of solving this problem. In a microkernel operating system, the kernel deals only with critical activities, such as controlling the memory and CPU, and nothing else. Drivers and other functions that monolithic kernels would normally include within the kernel are moved outside the kernel, where they are under control. Instead of being an uncontrollable part of the kernel the beta driver is, therefore, no more likely to cause a crash than a beta web browser. That is, if a driver goes wrong it can simply be restarted by the kernel. Unfortunately, creating microkernel based operating systems is very difficult and there are no common microkernel operating systems. Minix and QNX are both microkernel operating systems.

## References