Table of contents

Introduction to the Linux kernel (part1)

Published on Jan 11, 2021 by: Ahmed Elsayed

 What is the kernel

The kernel is the core of any operation system, and without it, your machine will not work at all, because it interacts with every piece of hardware inside your machine, so if any software installed on your machine want to talk to any piece of hardware, it talks to the kernel first, because it is the only thing that can do this job.

 What does the Linux kernel do

The kernel has 4 jobs:

1- Memory management: Keep track of how much memory is used to store what, and where.

2- Process management: Determine which processes can use the central processing unit (CPU), when, and for how long.

3- Device drivers: Act as mediator/interpreter between the hardware and processes.

4- System calls and security: Receive requests for service from the processes.

 Kernel space, and user space

The kernel, if implemented properly, is invisible to the user, working in its own little world known as kernel space, where it allocates memory and keeps track of where everything is stored. What the user sees like web browsers and files are known as the user space. These applications interact with the kernel through a system call interface (SCI).

 Programming language

Linux is written in C programming language supported by GCC (GNU Compiler Collection), the compiler is used to compile the source code of the kernel.

 Code base

As of 2020, the 5.6 release of the Linux kernel had around 33 million lines of code, roughly 14% of the code is part of the core while 60% is drivers.

 Maintenance and long-term support

The latest kernel version and older kernel versions are maintained separately. Kernel releases are mostly supervised by Linus Torvalds, and Greg Kroah-Hartman.

There are two different kind of kernels: normal releases, and Long-Term Support (LTS) releases.

Normal releases are supported for a few months, and reach the End Of Life (EOF) when a new release is announced, and you will have to update it to the new release.

LTS releases are supported officially for 6 years, so you can use it for a long time before deciding to update it.

The latest LTS releases are 4.4, 4.9, 4.14, 4.19, and 5.4

Version 4.4: maintained from January 2016 to February 2022.

Version 4.9: maintained from December 2016 to January 2023.

Version 4.14: maintained from November 2017 to January 2024.

Version 4.19: maintained from October 2018 to December 2024.

Version 5.4: maintained from November 2019 to December 2025.

Version 5.10 is the next LTS release.

That is the end of part one which contain all the basic information about the Linux kernel, but if you want to know more technical terms about the Linux kernel go to part Two

Introduction to the Linux kernel (part2)

 Licensing terms

Initially, Torvalds released Linux under a license which forbide any commercial use. This was changed in version 0.12 by a switch to the General Public License version 2 (GPLv2). This license allows distribution and sale of possibly modified and unmodified versions of Linux, but requires that all those copies be released under the same license and be accompanied by the complete corresponding source code.

 Loadable kernel modules

A loadable kernel module (LKM) is an object file that contains code to extend the running kernel of an operating system. LKMs are typically used to add device drivers for new hardware, and/or file systems, or for adding system calls.

When the functionality provided by a LKM is no longer required, it can be unloaded in order to free memory and other resources.

Loadable kernel modules in Linux are loaded, and unloaded by the modprobe command. They are located in /lib/modules, and have had the extension .ko (kernel object) since version 2.6.

The lsmod command lists the loaded kernel modules.

Loading a proprietary or non-GPL-compatible module will set a taint flag in the running kernel, meaning that any problems or bugs experienced will be less likely to be investigated by the maintainers. LKMs effectively become part of the running kernel, so can corrupt kernel data structures and produce bugs that may not be able to be investigated if the module is indeed proprietary.

That is why Nvidia proprietary (closed source) is currently partially incompatible with Linux >= 5.9, because they used GPL symbols for their non-GPL binary blob drivers, and it got blocked on Linux kernel 5.9, and this is Nvidia official announcement about this issue:

 Firmware binary blobs

The term usually refers to a closed-source kernel modules (device drivers) loaded into the kernel, and this term is sometimes also applied to code running outside the kernel, such as system firmware images, and microcode updates.

When computer hardware vendors provide complete technical documentation for their products, operating system developers are able to write hardware device drivers to be included in the operating system kernels. However, some vendors, such as Nvidia, do not provide complete documentation for some of their products and instead provide binary-only drivers. This practice is most common for accelerated graphics drivers, wireless networking devices, and hardware RAID controllers.

That is why you need to install drivers for these devices manually on Linux distributions, but there are some Linux distributions that offer a utility to identify, and install these drivers like: Ubuntu, and all Linux distributions based on Ubuntu.