Kernel - understand what the Linux Kernel is and how it works
If you are researching or are in the process of learning about the Linux system, you must have undoubtedly heard about the Linux Kernel, haven’t you? Understanding this concept is essential to understand other applications and resources of this open source.
Thus, understanding what the kernel is, not only in Linux, but in any operating system, as well as its purposes and variations, will greatly expand your knowledge base.
With that in mind, we developed this complete article, with everything you need to know about the Linux Kernel and its peculiarities. Just continue reading. Check it out!
Do you want to learn everything you need to pass the LPIC 101 exam? Check out our LPIC 101 exam preparation course.
What is Kernel?
Kernel, in a nutshell, is the matrix of any operating system. In a literal translation of the term, kernel means core, reinforcing its importance in the management of information and processes.
Without a kernel, nothing works, be it a computer or any other device that uses a robust operating system designed to meet the needs of users.
After all, the kernel is initialized as soon as the device is turned on, performing its function of recognizing, activating, and optimizing the use of physical computer parts, guaranteeing maximum performance.
And what is its purpose?
The purpose of the kernel, in a simple way, is to combine the physical and logical resources of a device. It is he who directs the use of RAM and video card when the user is trying to run heavier games or programs, for example.
The kernel is also responsible for organizing, controlling, and processing the data corresponding to user requests and demands from the device’s hardware components.
Thus, all file hierarchies, the distribution of components for the allocation in memory, in addition to reading and “translating” the data into actions, are the responsibility of this nucleus.
In short, it plays an indispensable role for the proper functioning of any operating system and cannot be ignored. Below, you’ll understand each essential kernel function in detail.
Memory Management
All virtual addresses, the size of the allocated files (whatever they are: images, texts, software, notebooks, essential disk fragments…), must be managed by the kernel.
It is he who decides where each item will be allocated after reading and identification. It also allows the user to modify and relocate their files as desired, and issues alerts when the system is about to be overloaded or running out of space.
Process management
All processes, from the initialization of the operating system to the maintenance of the software and programs that run simultaneously, are the responsibility of the kernel.
Your mouse clicks, file execution requests, and others are fulfilled by this core, which decides what information is most relevant to be carried out first by the available processor (or processors).
Device Management
Every time you insert a new device into the USB or Bluetooth inputs, be it a pendrive, mouse, keyboard, smartphone or printer, the kernel identifies, reads and executes it, most of the time in fractions of seconds.
Thus, all new elements attached to the system are read and approved by the kernel to be ready for use, connecting the hardware (physical device) with the software and internal elements of the system.
System calls
System calls, as their name suggests, correspond to the execution of specific commands and requests, with higher priority. Thus, the request is analyzed by the kernel, which approves the activities and allows the operating system to return the desired action.
In addition to understanding all the functionalities and characteristics of the kernel, as well as its main participation in our daily lives and coexistence with machines, it is necessary to understand what types of kernels exist and what differentiates them.
Types of Kernels
Photo: relationship between kernel and software. The Linux kernel has several possibilities for variations. It can be monolithic, microkernel, or hybrid. Each one has its own peculiarities and characteristics.
It is important to understand the difference between kernel types and their uses in Linux in order to complement your knowledge and “connect the dots” so that the information makes sense.
Monolithic kernel
The monolithic Kernel is structured in a single binary file, a single process that runs entirely in protected mode.
It performs better when passing messages, but has numerous drawbacks, such as the difficulty of changes to the core and the waste of resources, since device drivers remain constantly in memory, even when the devices are not being used.
Monolithic Kernel implementations, because they do not have several components scattered around, have greater immunity against viruses and other malicious programs.
Microkernels
In the microkernel, only a small part of the kernel runs in protected mode to directly access the hardware, and is also responsible for communication between processes and memory management.
The rest of the system runs in user mode, since it performs tasks that do not require direct access to the hardware, and its classic services are guaranteed by server processes.
In theory, this concept makes the kernel more responsive, since more code is executed in the user space and increases stability because there is less code in the kernel space.
Also, since the system has parts that are executed as small services, this type of implementation takes advantage of multiprocessed architectures. But on the other hand, it requires a great deal of design effort from its developers.
System resources are accessed through a client/server protocol, and to add a new service, simply add a new server.
The microkernel performs poorly than the monolithic model, but its parts can be changed without the need to restart the machine, allowing it to expand to a distributed system more easily.
The parallel microkernel can be understood as a set of cooperative local microkernels, one at each node of the parallel machine. The crucial point is the communication between processes on the same processor or on different processors, according to a client/server protocol.
The module responsible for communication has the basic functions for receiving messages from other processors, receiving results of operations performed remotely, and sending messages to other processors.
Its organization is based on the client/server model, where system services are implemented by specialized servers.
Clients, which are application programs, request services from the operating system that refer them to server processes. They receive the request and execute it, sending the result back to the microkernel and then to the application.
Hybrid Kernels
Simply put, the hybrid kernel combines features of the monolithic kernel and the microkernel, merging “the best of both worlds” and forming a new, totally interesting architecture.
Consider, for example, the advantages and disadvantages of each of the previous models:
- disadvantages of the monolithic kernel: waste of resources, takes up unnecessary space in memory, since it executes all the drivers at once, without you necessarily needing them;
- advantages of the monolithic kernel: security and low chances of malicious attacks;
- disadvantages of the microkernel: lower performance;
- advantages of the microkernel: responsiveness and less space occupied in memory.
With this in mind, the hybrid kernel, like the microkernel, avoids system overload through monoprocessing (or function distribution) resources, as is the case with the monolithic kernel.
A good example of a hybrid kernel is Windows NT, released in the 90s. Understanding these points is part of learning about the architecture of the Linux system, which is required under various certifications.
Everything will make even more sense when you study the history of Linux, as well as the propositions and idealizations of its creator, Linus Torvalds, called “the father of Linux”. Just continue reading to understand more.
How does the Kernel system work?
Photo: How the Kernel system works. Without a doubt, the Kernel is the most important part of any operating system and is considered the core of the system.
It is responsible for low-level functions, such as memory management, process management, file subsystems, network, support for devices and peripherals connected to the computer.
The Linux Kernel
The Linux kernel (Linux kernel in English) is an open source monolithic kernel for UNIX-like operating systems.
Developed for both computer systems, whether personal computers or servers, usually in the form of Linux distributions, and embedded in various devices, such as:
- routers;
- wireless access points;
- PABXs;
- television receivers;
- Smart TVs;
- DVRs;
- and network storage devices.
Android operating systems for Tablets, Smartphones, and Smartwatches use services provided by the Linux kernel to implement their functionalities.
While adoption on desktop computers is considered low, Linux-based systems dominate almost every other segment of computing: from small mobile devices to rugged Mainframes.
According to the ranking of the 500 most powerful supercomputers in the world, as of November 2017, all of the ranking are running Linux.
Linus Torvalds, the father of Linux
The Linux kernel was conceived and created in 1991 by Linus Torvalds for his personal computer, without any multiplatform intention.
But since then, it has expanded to support a large number of computer architectures, far beyond other operating systems or kernels.
Linux quickly attracted developers and users who adopted it as the core for other free software projects, most notably the GNU operating system.
The Linux kernel received contributions from approximately 12,000 programmers from over 1,200 companies, including some of the world’s largest software and hardware vendors.
Since a kernel does not work alone, the “GNU” project helped Linus Torvalds, thus creating GNU/Linux.
Conclusion
Did you notice how, although frightening, the term kernel is simple to understand? Its indispensable participation in any system makes it even more didactic and palpable, since no command or software can be executed without it.
The Linux kernel is no different: it assumes a master role and needs to be well understood, especially by those scholars who wish to become professional and have their knowledge validated through exams and competency tests.
Now, you already understand part of the architecture of the Linux system, and are ready to advance your learning process. If you are preparing for a certification, you need solid, didactic, and logical information.
To this end, we invite you to discover the Linux Certification preparatory courses, designed to facilitate your approval. Our teaching methodologies approve 93% of candidates who commit to applying them.
It’s worth checking out and securing your place in one of our preparatory courses, depending on the level of certification you want to apply for!