What is Kernel in Operating Systems? [Functions & Modes]

The computer system is a collection of diverse hardware and software. As users, we work in the abstract user space which is the software segment, whereas the hardware components perform tasks at the physical level. Now how do we interact with the hardware? This is where the concept of Kernel comes in. In this article, you will get to learn what is Kernel and its objectives.

What is Kernel?

A kernel can be defined as the core of an operating system. It is an interface that resides in the middle of the software and hardware ensuring interactions between these components. Furthermore, it is the first program (after the bootloader) loaded into memory at the system start-up and remains in the backend till the OS is shut down. This core process keeps the system running, managing and integrating all the hardware and software operations.What is kernel in operating systems (OS). Kernel Space:

Since Kernel is the heart of the operating system and is responsible for crucial tasks, it is loaded into separate memory space and kept reserved. This separate memory space where Kernel executes processes and provides services is called the Kernel Space. This partition is created to provide both memory and hardware protection.

User Space:

The Userspace is the memory space on a system available for user applications. Every program of the operating system except for the Kernel executes in this space.

Difference Between Kernels and BIOS

The BIOS stands for “Basic Input/Output System”. It is the computer program embedded in the motherboard that starts the system at power-on. In simple words, BIOS is not a part of the operating system but a set of small programs. On the other hand, Kernel is the core of the operating system. BIOS starts up the system, performs basic tests, and transfers control to the Kernel.

User Mode Vs Kernel Mode

The system offers two modes of operation: User Mode and Kernel Mode. The purpose of this division is to secure the operating system from any kind of malicious or unwanted activities. The system boots with the Kernel mode where it has complete access to the hardware and resources. Specific operations such as memory management can only be accomplished in this highly privileged mode. On the contrary, User mode is the restricted one where it cannot access the resources directly. Applications running in User mode must make a system call to the Kernel to use system resources. A switch from User mode to Kernel mode occurs when a system call takes place.

Functions of Kernels

The Kernel of an Operating system has control over the whole system and is responsible for various tasks. Some of the major functions are described here.

A. Device Management

Manages the allocation of peripheral devices connected to the system such as mouse, keyboard, etc. It controls these devices using device drivers, a computer program that enables the communication between OS and hardware devices.

B. Memory Management

Every process on our computer needs some memory space to run on the machine. The Kernel is responsible for allocating as well as deallocating the memory space to these processes to complete their execution.

C. Resource Management

The crucial task of sharing the limited resources among the processes running on the machine is done by the Kernel. Each of the processes has uniform access to these resources.

D. Access Computer Resource

Kernel Has access to resources such as RAM, ROM, I/O devices, etc. It acts as a bridge between the users and the system resources.

Types of Kernel

In general, we can divide it into five kinds. These categories are mainly based on the number of address spaces supported by the Kernels. Below are the descriptions of these different categories.

1. Monolithic Kernels

The Monolithic type has the simplest form. In this variation, the same memory or address space is used for both Kernel Services and User Services. Such implementation increases the size of the Kernel which increases the size of the operating system as well.Structure of monolithic kernel. Advantages:

  • Offers faster process execution as there is no separate memory space for the user.
  • CPU scheduling, memory scheduling and file management occur using System calls only.

Disadvantages:

  • Any service failure crashes the whole system.
  • Increased size introduces difficulty in management.
  • Adding new service requires entire operating system modification.

2. Microkernels

Microkernel is implemented in two different memory spaces: Kernel Space and User Space. The size of the operating system in this type is decreased since separate deployment reduces the Kernel size.Structure of microkernel.Advantages:

  • Offers a stable system due to separate user space and kernel space.
  • Flexible and easily manageable.
  • Adding new services does not raise an issue.

Disadvantages:

  • Requires a large number of system calls.
  • Context switching reduces overall communication speed.
  • Introduces difficulty in bug fixing and process management.

3. Hybrid Kernels

The Hybrid one is a combination of Monolithic and MicroKernels. It employs the advantages of both variations. It offers the speed of the Monolithic type by running some of the services in Kernel space. Adding modularity to the Microkernel introduces stability to the system.Structure of hybrid kernel. Advantages:

  • Improved performance.
  • Flexibility and stability gained from the kernel combinations.
  • Easy technology integration due to modularity.

Disadvantages:

  • Difficult to maintain, develop, and debug.
  • May raise compatibility issues with different hardware and software platforms.

4. Nano Kernels

The Nano type supports a nanosecond clock resolution. It contains the fewest lines of codes which makes it the smallest kind. These are mainly implemented on embedded systems or devices with limited resources. It provides hardware abstractions even without any system services. However, the lack of system services comes with limited functionality.

5. Exo Kernels

The Exo kind is a variation of Microkernel. Designed for mobile devices, it has separate resource protection and management which enables application-specific customization. The fewest hardware abstractions offered in this type complicate the design for developers.

An Overview of the Linux Kernel

The Linux Kernel is actually monolithic where the whole operating system virtually works in the Kernel Space. It is the core component of the Linux Operating System. It is a free, open-source, and modular operating system component that lies between the processes and hardware of a computer. Furthermore, it is modular as it keeps only the necessary modules in the kernel memory and allows the insertion/removal of these modules at runtime to increase the performance of the system. As it is a free and open-source interface currently numerous developers are working on it.

In Linux OS you can view the available kernels, the running kernel, and the modules under the running kernel. Besides, the Linux Kernels reside in the \boot directory. Below are some examples of viewing the Linux kernels available on your system.

A. Viewing Available Kernels in the System

You can view the available Linux kernels by listing the contents of the \boot directory. To do so you can follow the steps below.

Steps to Follow >

➊ At first, launch the Ubuntu Terminal.

➋ Then, Type the following command in the command prompt:

ls /boot

➌ Finally, Hit the ENTER button.

Output >

Viewing Available Kernels in the System.In the following image, you can see that I have displayed the available kernels on my system.

B. Displaying Running Linux Kernel

You can view the currently running kernel on your system using the uname command with option -a. Now, Follow the instructions given below to display the running version on your terminal.

Steps to Follow >

➊ At first, go to the Ubuntu Terminal.

➋ After that, Type the following command in the command prompt:

uname -a

➌ Then, Press ENTER.

Output >

Displaying Running Linux Kernel.In the given image, you can see that I have displayed the running kernel on my system.

C. Viewing List of Kernel Modules

In Linux, the kernel modules reside in the lib/modules directory. You can list the modules from this directory using the ls command. Below I will list the modules of the currently running 5.15.0-58-generic” version from the “lib/modules/5.15.0-58-generic” directory. Follow the given steps to do the same.

Steps to Follow >

➊ At first, open the Ubuntu Terminal.

➋ Then, Type the following command in the command prompt:

ls lib/modules/5.15.0-58-generic/

➌ Finally, Hit ENTER.

Output >

Viewing List of Kernel Modules.In the given image, you can see that I have listed the modules of the “5.15.0-58-generic” version on my system.

Conclusion

This article dives into the details of the Kernel in operating systems and presents its possible definitions, varieties, and functionalities. In addition, it includes a short overview of the most popular Linux Kernel. In brief, this interface is the heart of the operating system that we run on our everyday computers. Moreover, its significance lies in how it is designed to stand between the hardware and software and ensures the necessary interactions for creating a proper processing system.


Similar Readings

5/5 - (1 vote)
LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now
Anonnya Ghosh

Hello there! I am Anonnya Ghosh, a Computer Science and Engineering graduate from Ahsanullah University of Science and Technology (AUST). Currently, I am working as a Linux Content Developer Executive at SOFTEKO. The strong bond between Linux and cybersecurity drives me to explore this world of open-source architecture. I aspire to learn new things further and contribute to the field of CS with my experience. Read Full Bio

Leave a Comment