Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
Kernel
2.1.
Purpose of Kernel
2.2.
Where is Kernel
3.
Functions of Kernel
3.1.
Memory Management
3.2.
Device Management
3.3.
Accessing Computer Resources
3.4.
Resource Management
4.
Types of Kernel
4.1.
Monolithic Kernels
4.1.1.
Advantages
4.1.2.
Disadvantages
4.2.
Microkernel
4.2.1.
Advantages
4.2.2.
Disadvantages
4.3.
Hybrid Kernel
4.3.1.
Advantages
4.3.2.
Disadvantages
4.4.
Nanokernel
4.4.1.
Advantages
4.4.2.
Disadvantages
4.5.
Exokernel
4.5.1.
Advantages
4.5.2.
Disadvantages
5.
Frequently Asked Questions
5.1.
What is a Kernel?
5.2.
What are the types of Kernel?
5.3.
What are the main functions of Kernel?
5.4.
Which type of Kernel is used by Windows?
5.5.
Which type of Kernel is used by Android?
6.
Conclusion
Last Updated: Mar 27, 2024

Kernel in Operating System

Operating System

Introduction

We write programs to do some particular tasks. Operating and managing a computer system is also a task, and it's a very complex one. So we need a program to manage the computer system as well. Right? So, the program that manages the whole computer system is the Kernel. Now, let's learn about the Kernel in this article. At the end of this article, you will understand the importance of Kernel. We will also discuss the different kinds of Kernel. So, let's begin.

Also Read, FCFS Scheduling Algorithm, Multiprogramming vs Multitasking

Kernel

A kernel is a computer program at the core of a computer's operating system. It generally has complete control over everything.

It is one of the first programs to be loaded up on the memory before the boot loader. It manages the memory as well as peripherals such as keyboards and monitors.

It acts as a primary interface between the hardware and the processes of a computer. The Kernel connects these two to adjust resources as effectively as possible.

Purpose of Kernel

We discussed that Kernel is one of the most critical parts of the operating system. So, let's discuss the jobs which the Kernel does. Below given are some of the purposes served by the Kernel.

  • It determines the processes that will go next in the CPU(Central Processing Unit), for how long, and when.
  • It monitors what amount of memory is being used to store what and where it is stored.
  • Kernel serves as an interface between the processes and the hardware.
  • It receives requests from the processes through system calls.

You can also check this out: Demand Paging in OS

Where is Kernel

You must be wondering by now where the Kernel is stored so that you can modify and customize the Kernel. But there is bad news if you are thinking of doing so. You can't access the Kernel. If the Kernel is implemented appropriately, it's out of sight of the user. It operates in its area called the kernel space. It allocates memory to the processes and monitors where everything is stored in the kernel space. The user space is the environment where you see the files and browsers. The programs communicate with the Kernel using a system call interface.

Remember about kernel space and user space as we will use them in discussing the types of Kernel later in this article.

Click on the following link to read further: Multitasking Operating System

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Functions of Kernel

A Kernel performs many tasks, as we have discussed above. Now, let's learn about the functions performed by Kernel in detail. We have listed the tasks performed by Kernel in the below-given list.

Memory Management

The Kernel has full access to the computer's memory. Whenever a process requires some memory, the Kernel enables that process to safely access the memory, ensuring that no two applications crash into each other. The Kernel uses the paging and segmentation techniques of virtual addressing to give access to memory to the processes safely.

Device Management

The processes often need access to the computer's peripheral devices to perform their tasks. For example, the application needs access to the camera to record a video. The Kernel is responsible for controlling and managing these peripheral devices using device drivers. Device drivers are programs for specific devices which enables the OS to control them.

Accessing Computer Resources

A kernel is responsible for accessing computer resources such as RAM and I/O devices. Kernel decides which memory is to be used by each process and what to do if the required memory is unavailable.

Resource Management

The Kernel is responsible for sharing the available resources between various processes. It is one of the most important functionalities of the Kernel. It must ensure that each process has uniform access to the available resources. It is also responsible for the communication between processes, i.e., inter-process communication (IPC) and context-switching between processes.
 

Must Read Process Management in OS

Types of Kernel

There are five types of Kernel. Each of them is mentioned below with its explanation, advantages, and disadvantages.

Monolithic Kernels

The Kernel and userspace use the same memory space in a monolithic kernel. This means that no different memory space is used for user services and kernel services. The OS's overall size increases since it uses the same memory space. The execution of processes is faster in this type of Kernel as the same memory space is used for user and kernel services.

Example: Unix, Linux, XTS-400, etc.

Advantages

  • Execution of processes is faster.
  • Since it is a single piece of software, its sources and compiled form are smaller.

Disadvantages

  • If a new service is to be added, the whole operating system needs to be modified.
  • This type of Kernel is not portable. For each different architecture, the Kernel needs to be rewritten.
  • If a service generates an error, the whole system may crash.
  • Its size is larger and hence difficult to manage.

Microkernel

In this type of Kernel, the user and Kernel services are implemented into two different address spaces, i.e., user and kernel spaces. It is easier to manage and maintain than Monolithic Kernel, but it may perform slower if many system calls and context switching are made.

Microkernels provide only some essential services like defining memory address space, Inter-Process Management, and process management. The Kernel does not offer other services like networking. Instead, they are handled by a userspace program known as Server.

In microkernels, there will be no system crash when a process crashes, and it can be resolved by just restarting the error-caused services.

Example: Amigos, Minix, L4, etc.

Advantages

  • Easily manageable
  • New services can be easily added without modifying the existing OS.
  • If a kernel process crashes, a system crash can be prevented by restarting the error-caused services. Hence it is more stable.

Disadvantages

  • System performance is reduced due to the increased requirement of software for interfacing.
  • Process management in microkernel is complicated.

Hybrid Kernel

Hybrid Kernels are a combination of both Monolithic kernels and Microkernels. It combines the speed of Monolithic Kernel with the modularity of Microkernels. It is similar to a microkernel, but it also includes some additional code in kernel space to enhance the system performance. Hybrid Kernel allows to run some services like network stack in kernel space, but it still allows kernel code like device drivers to run as servers in userspace.

Example: Windows NT, BeOS, Netware, etc.

Advantages

  • No requirements for a reboot for testing
  • Third-party technologies can be integrated rapidly.

Disadvantages

  • Possibility of more bugs due to more interfaces to pass-through
  • It is challenging for the administrators to maintain the modules.

Nanokernel

In Nanokernel, the complete code of the Kernel is very small. This means that the code getting executed in the privileged mode of hardware is very small. In Nanokernel, the term nano defines the support for a nanosecond clock resolution.

Example: EROS, etc.

Advantages

  • It can provide hardware abstraction even with a very small size.

Disadvantages

  • It lacks the system services.

Exokernel

In Exokernel, resource protection is separated from the management part, which allows us to perform application-specific customization. It follows the end-to-end principle. It has the fewest hardware abstractions possible and allocates the physical resources to applications.

Advantages

  • It provides better support for application control.
  • Improved performance of applications.
  • Applications are allowed to have their optimized memory management system.

Disadvantages

  • The design of exokernel interfaces is complex.

 

The whole article can be summarized as given below.

A kernel is the core part of an Operating System. It comprises five types: Monolithic Kernel, Microkernel, Hybrid Kernel, Nano Kernel, and Exo Kernel. The main functions of Kernel are memory management, resource management, and device management.

You can also read about layered structure of operating system.

Read about Batch Operating System here.

Recommended Topic - Memory hierarchy in computer network

Frequently Asked Questions

What is a Kernel?

A kernel is a computer program at the core of a computer's operating system. It generally has complete control over everything.

What are the types of Kernel?

 Kernels are of five types: Monolithic Kernel, Microkernel, Hybrid Kernel, Nano Kernel, and Exo Kernel.

What are the main functions of Kernel?

The main functions of the Kernel are memory management, device management, and resource management.

Which type of Kernel is used by Windows?

Windows uses Hybrid Kernel as it combines the performance of a monolithic Kernel with the stability of a microkernel.

Which type of Kernel is used by Android?

Android Operating System, widely used in smartphones, is based on the Linux Kernel, which uses the monolithic type of Kernel.

Conclusion

We have extensively discussed Kernel in Operating systems in this article. We hope that this blog has helped you understand what Kernel is and what are its functionalities and types. You can refer to the below-given articles to enhance your knowledge of Operating Systems.


Do check out The Interview guide for Product Based Companies as well as some of the Popular Interview Problems from Top companies like Amazon, Adobe, Google, Uber, Microsoft, etc. on Coding Ninjas Studio.

Also check out some of the Guided Paths on topics such as Data Structure and Algorithms, Competitive Programming, Operating Systems, Computer Networks, DBMS, System Design, etc. as well as some Contests, Test Series, Interview Bundles, and some Interview Experiences curated by top Industry Experts only on Coding Ninjas Studio.

Do upvote our blog to help other ninjas grow.

Happy Learning!!!

Previous article
Difference Between Multitasking and Multiprocessing
Next article
What is Bootloader
Live masterclass