What is a Kernel in OS? What are the types of Kernel?

What is a Kernel in OS
Every operating system- whether it is Windows, Mac, Linux, or Android, has a core program called a Kernel which acts as the ‘boss’ for the whole system. It is the heart of the OS! The Kernel is nothing but a computer program which controls everything else. Anything that happens on the computer goes through it. In this post, we will discuss what is a Kernel in an OS, and the different types of Kernels.

What is a Kernel in OS

Now that we know that its a core program in the OS, one should also know it is also the first program that loads after the bootloader. It then does all the talking between the hardware and the software or applications. So if you launch a program, the user interface sends a request to Kernel. The Kernel then sends a request to CPU, Memory to assign processing power, memory, and other things so the application can run smoothly in the front end.

You can imagine Kernel as a translator. It converts input/output requests from software into an instruction set for the CPU and GPU. In simple words, its a layer between the software and the hardware which makes everything possible. The kernel manages the following:

  1. CPU/GPU
  2. Memory
  3. Input/Output or IO devices
  4. Resource management
  5. Memory management
  6. Device management
  7. System calls.

User processes can access kernel-space only through the use of system calls. If a program tries to access directly, it will result in a fault.

Kernel Security & Protection

The kernel also protects the hardware. If there is no protection, any program will be able to carry out any task on the computer, including crashing your computer, corrupting data, etc.

In modern-day computers, security is implemented on the hardware level. For example, Windows will not load drivers which are not from a trusted source and certified using signature. Secure Boot and Trusted Boot are classic examples.

Secure Boot: It is a security standard developed by members of the PC industry. It helps you protect your system from malicious programs by not allowing any unauthorized applications to run during the system start-up process. The feature makes sure that your PC boots using only software that is trusted by the PC manufacturer. So, whenever your PC starts, the firmware checks the signature of each piece of boot software, including firmware drivers (Option ROMs) and the operating system. If the signatures are verified, the PC boots and the firmware gives control to the operating system.

Trusted Boot: It uses the Virtual Trusted Platform Module (VTPM) to verify the digital signature of the Windows 10 kernel before loading it. In turn, it confirms every other component of the Windows startup process, including the boot drivers, startup files, and ELAM. If a file has been altered or changed to any extent, the bootloader detects it and refuses to load it by recognizing it as the corrupted component. In short, it provides a chain of trust for all the elements during boot.

What are the types of Kernel

The Kernel can also talk to hardware on a secure line. So companies can develop a Kernel which can talk to their hardware through a set of buttons. Take the washing machine for an example. Depending on the knobs you move, and time you set – a basic level of Kernel should be enough.  That said, Kernel themselves grow complicated with time, which results in types of Kernel.

  1. Monolithic Kernel: Here, the OS and Kernel both run in the same memory space and suitable where security is not a significant concern. It results in faster access, but if there is a bug in the device driver, the entire system crashes.
  2. Microkernel: Its a stripped-down version of Monolithic Kernel where the Kernel itself can do most of the job done, and there is no need of an extra GUI. They should be used where security and the crashing system isn’t or will not happen.
  3. Hybrid Kernel: This Kernel is what we see most. Windows, Apple’s macOS. They are a mix of Monolithic Kernel and Microkernel. It moves out drivers but keeps system services inside the Kernel – similar to how drivers are loaded when Windows Starts the bootup process.
  4. Nano Kernel: If you need to have a kernel, but its majority of function is set up outside, then this comes into the picture.
  5. Exo Kernel: This kernel only offers process protection and resource handling. However it is mostly used when you are testing out an inhouse project, and you upgrade to a better Kernel type.

There is a lot more to a Kernel than what we have talked about. As you dig deeper, the definition of Kernel gets broader and more profound.

We hope the post was easy to understand and helps you get through the basic.