Linux Kernel: How Does it Work and What Version to Use
Normally, when we talk about Linux, we usually do it in relation to distributions such as Ubuntu, Debian, Mint, etc. However, these distributions are not operating systems as such, but rather are “adaptations” of an open source operating system: Linux. And, therefore, despite the peculiarities of each one, they all share the same base, what we know as Linux Kernel .
Linux, as its own documentation indicates, was born as a clone of another operating system called Unix. Specifically as an alternative system inspired by Minix (which, in turn, cloned the concepts of Unix). Due to its properties, Linux is a real operating system, although nobody uses it as such, but rather uses distributions since, with them, it becomes much more useful and easy to use.
For this reason, it is not usually said ” I am going to install Linux ” referring to a specific operating system, but rather that what we install are versions, or distributions, of this kernel, created by companies or by the community, that share the same base: the Kernel.
What is the kernel and what is it for
The Linux kernel is the core of the operating system . This is the most important piece of software in any operating system. Windows has its own private kernel, Apple has its own (based on Unix, by the way), and Linux is the kernel used by all distributions. And its main function is to be in charge of controlling the computer hardware.
Specifically, this kernel is responsible for managing system memory and process time , managing all processes , controlling system calls and connections between processes and allowing all software to have access to the hardware , especially the connected peripherals. to the computer.
The kernel is so important when controlling hardware that, of its more than 28 million lines of code, most of it is drivers. And this, while good for compatibility, is starting to be a problem for performance.
Under normal conditions, users never interact with it . While users have limited access to hardware, the kernel has full access and control over it. He is responsible for ensuring that everything works well, that it is done safely, and that there are no errors. If a process crashes in user space, Linux continues to function . And you can even try to recover the system by having control over the PC. However, if an error occurs in kernel space, then the whole system stops working. It is what we know as the ” Kernel Panic “, the equivalent of the blue screen in Linux.
Versions
It is true that the current versions of the kernel have nothing to do with the first ones from 1991. However, this kernel is in constant development. And every few weeks we usually see new releases. But not all are equally important, since it depends to a great extent on their numbering.
- a indicates the version. This number is the one that changes the least, since the jump is usually only made when there are extremely large changes in the system. In all its history, it has only changed 5 times, in 2004, for version 1.0, in 2006, for version 2.0, in 2011, for version 3.0, in 2015, for version 4.0, and in 2019 to give rise to the current version, 5.0.
- b indicates subversion. When new versions are released, but they are really minor updates (new drivers, optimizations, fixes, etc), then instead of changing the version, the subversion number is changed.
- c indicates the revision level . This number is often changed, for example when minor changes are made, such as security patches, bug fixes, etc.
- d is the last sublevel of the version. It is hardly used, but it is reserved so that, if a version with a very serious bug is released, the new version is released with this sublevel including exclusively the correction of said serious bug.
All versions of the Linux kernel are public and open source. We can find them in this link . But they are not compiled, rather it is the users themselves who have to compile them to be able to use them in their distribution. And this is not exactly a simple task. Luckily, the communities responsible for the development of the different distributions usually bring us compiled and optimized versions of the Kernel, which we can install as any patch.
Which version of Linux to choose
When we talk about software, we always recommend having the latest version of everything. This is the best way to ensure that, due to a security breach, our PC is endangered. With the Linux kernel it is the same, it is always recommended to have the latest version. However, you always have to do it carefully.
One of the reasons the kernel is so big is because it doesn’t remove anything. As old as it is. Thanks to this, it is possible to continue using the latest versions of Linux on the first computers where it was launched for the first time in 1991. Each update what it usually does is add drivers and change functions to optimize the general operation of the PC.
But it may happen that a version brings a bug that makes our PC not work properly, and even that the performance is not as expected. In that case, simply reinstalling a previous version should bring the operating system back to normal. Although we will lose support for the newer hardware components.
The best, and easiest for most, is to update the Kernel as we update the distribution from its repositories. Thus we will avoid these problems by “always being up to date”.
Is the kernel the operating system?
- Demon controller . Whether Init.d, Systemd, or any other similar software, it is necessary to have a subsystem above the kernel that is responsible for starting all the processes (daemons) necessary for the Kernel to start working. Without it we only have many lines of code that will not be executed.
- The processes . Daemons, daemons, or better known as processes, are all the components that remain loaded in the system memory (controlled by the kernel) and that allow Linux to function. The graphical server, for example, is the daemon that will control the desktop.
- Graphic server . Known as X, it is in charge of being able to see the graphics on the screen. If we are going to use Linux in text mode, from the terminal, it is not necessary. But if we are going to use it with a desktop, it is necessary to have a working x-server.
- Desk. As its name suggests, the computer desktop, where we will have all our programs and where the windows will open. There are many desktops for Linux, such as GNOME, KDE, or LXDE. Each one with its own characteristics, advantages and disadvantages.
- Programs. Everything we run from the desktop. It is already the highest layer, and the point through which we interact with the computer.
When the kernel, and everything else, works in accordance, that is when we can talk about the operating system. Or what is the same, Linux distribution .
Linux Kernels – 4 Different Types of Kernels Explained
When it comes to Linux Kernels, often it might be intimidating for beginners to choose from the huge list of array of available options, especially during Arch Linux installation and such. In this module, we will look at some of the major kernels available out there and help you choose the best one for you.
1. Stable Linux Kernel
It is the latest stable release Linux kernel available and hence is the default kernel used by most distributions. It somewhat compromises stability for bleeding edge and hence is sometimes considered unstable in nature.
This kernel can be installed with :
The kernel is regularly updated and new patches are released quite frequently. Inspite of it’s bleeding-edge nature, the kernel is still widely used on desktops and servers alike.
2. LTS Kernel
This gives to the latest Long Term Support (LTS) kernel available and is considered the comparatively ‘more stable’ than the default kernel. However, it sometimes uses older drivers which might not be compatible with newer hardware and might lack some features of the newer kernel releases. The LTS kernel doesn’t have a fixed release cycle but the usually it is updated every 3 years for desktop and every 5 years for servers.
You can install the latest LTS kernel with :
Security patches are rolled just as frequently to the LTS kernel as well. However, it is still susceptible to “breaking” but the chances of that happening are a tad bit less as compared to the default Linux Kernel and hence it is often favored at an Enterprise level. For example, according to Canonical, an estimated 95% of all Ubuntu installations are LTS releases.
3. Hardened Kernel
It is the hardened version of the Linux stable kernel but is more security-tailored and comes with upstream patches before Linux does. It has a security oriented kernel configuration. It can be installed with :
$ sudo pacman -S linux-hardened
Note that some programs and features might not work with this kernel. This kernel is not as popular as the other ones on the list as it has huge downtimes. The kernel kills any process it deems as a threat. Also, all PID’s are not discoverable, and thus a running executable cannot be addressed directly which limits the potential attack vectors for threat actors. Extra security is also implemented via patches.
4. Zen Kernel
It a kernel tuned for performance, aimed at improving performance of desktops at the cost of throughput and power usage. It is also sometimes considered the best kernel for gaming. It has a low latency and high-frequency scheduling. You can install it with :
The kernel facilitates faster speeds and features a more optimized scheduler. Infact, some modern distros like Garuda Linux use the Zen kernel as the default kernel to optimize performance on desktops and PCs.
Conclusion
These are most popular in Linux Kernels but the options aren’t limited to these. Everyday, newer variants keep evolving. The source code of these kernels are open source and you can even build your own kernel to suit your needs !