Linux Kernel Explained I

By Srijan 26 May, 2018
linux kernel

Linux kernel is the core of any Linux Operating System. A Linux Distribution consists of a Linux Kernel and other supporting software/tools which are required for file operations, user management, system management etc. Each of these software/tools performs small tasks of the complete system.

Kernels, in general, are classified on basis of whether they perform critical system tasks in Kernel Space or User Space. They are classified as Monolithic, Microkernel and Hybrid Kernel. Linux is a Monolithic Kernel. Let's discuss them in little detail to have a better understanding of their working principles.

User Space and Kernel Space

System Memory consists of RAM (Random Access Memory) cells, which are accessed at extremely high speed but data in them are retained for a very short period of time. RAM hold programs and data that are currently in use by CPU because access time to main storage (Hard drives) are very high. Therefore RAM acts as a high-speed intermediary between system CPU and hard drive.

linux architecture
User space and Kernel Space

System Memory is divided into two distinct areas - Kernel Space and User Space:

User Space

In User space, user applications are executed. All user processes run in this space. A process is a running instance of a program. The kernel manages user processes in user space to prevent them from interfering with each other.

GNU C Library (glibc) also resides in User Space. It provides the System Call Interface which provides the mechanism to transition between the user-space application and the Kernel. More on it later.

Kernel Space

Kernel space is where core operating system codes are executed. The kernel provides its services using this space.

Linux is a Monolithic Kernel

monolithic kernel
Linux is a monolithic kernel

Monolithic kernel is an operating system architecture where the entire operating system is running in kernel space. In a monolithic kernel, the OS runs in supervisor mode and the applications run in user mode. Supervisor mode enables execution of all instructions, including privileged instructions. As more code are executed in supervisor mode, the monolithic kernel has a larger memory and install footprint.

In Linux, however, developers found a way to solve this problem by creating dynamically loadable modules. Modules can be loaded dynamically at runtime. These modules allow easy extension of the operating system's capabilities as per user requirement. A module typically adds functionality to OS for things like devices, file systems, and system calls.

Third party drivers and software are not installed by default in many distributions because they are closed source. These drivers and software are made available by there developers as pre-compiled modules. These modules are free as in beer but are not free as in speech. For these reasons, they are not pre-loaded into the kernel for most of the Linux distributions.

Microkernel

Microkernel whereas only perform critical tasks in kernel space. Pretty much everything else is executed in user space. For that reason, Microkernel has less memory footprint and is more secure. We will have the discussion about different types of kernel and their architecture in another article.

Linux kernel is constantly evolving. Thousands of people around the world are contributing to its development daily. You can find information about current and previous releases of kernel at www.kernel.org.

Useful Resources


Recommended Reading



Follow us on
Sponsored