Understanding the Linux Kernel
The Linux kernel is the kernel used by Linux-based operating systems and the interface between the hardware and the computer processes. A kernel is a special program responsible for managing the low-level functions of a computer.
As such, kernels are the most basic, and also the most important, part of an operating system. Modern operating systems also provide a variety of other tools and services – such as log collection and user management features, to name just a couple – but it’s the kernel that provides the most crucial and most basic functionality at the heart of the operating system by unifying hardware and software.
Linux is just one of thousands of kernels in existence. Other operating systems have their own kernels, and as we discuss below, there are many different types of kernel architectures in existence. But all kernels perform the same core tasks required to make an operating system work.
The Linux Kernel vs. Linux OS
It’s common to hear the term Linux used to refer to any operating system that uses Linux as its kernel. Technically speaking, though, Linux is just a kernel. The rest of the software that runs on a Linux-based operating system – such as graphical user interfaces, Web browsers, and productivity applications – is not part of the Linux kernel. It’s provided by other projects.
For that reason, you may sometimes hear people use the term GNU/Linux to refer to Linux-based operating systems, such as Ubuntu or Red Hat Enterprise Linux.
They do this because many (though not all) of the programs that developers combine with the Linux kernel to create a complete Linux-based OS are developed by the GNU project, which creates a wide range of open source software. Linux is not developed by GNU, and so to give credit to the work of GNU developers in addition to the Linux kernel developers, people use the phrase GNU/Linux.
But other times, they might say just Linux when they’re referring to a complete Linux OS, not just the Linux kernel.
The bottom line here is that the term Linux can be used to refer specifically to the kernel or to any operating system that uses the Linux kernel in addition to programs from other sources in order to provide a complete operating system.
Linux vs. Unix
You may also sometimes hear people use the term Linux somewhat interchangeably with Unix. This is because the Linux kernel is designed to operate in the same way as the kernel for Unix, an operating system developed between 1969 and the mid-1990s.
Because the Unix kernel was only compatible with certain types of computer hardware and was subject to licensing restrictions, a number of programmers developed their own kernels to serve as alternatives to the Unix kernel. Linux is one example of these alternatives.
Other popular examples include the kernels used by FreeBSD, NetBSD, and even macOS.
To be clear, Linux does not use any source code from Unix. It’s simply designed to work similarly to the Unix kernel. For that reason, Linux is often described as a Unix-like kernel. Linux can be used to run systems that are like Unix, but Linux is not Unix.
Linux Kernel Architecture
Like most modern kernels, the Linux kernel uses what’s known as a monolithic kernel architecture. This means that the kernel runs as a single program.
An alternative to Linux’s kernel architecture is the microkernel architecture, which breaks the kernel into smaller, discrete programs. Microkernels were a popular concept in the 1980s and 1990s, but many attempts to implement them were not as successful as hoped.
Operating systems like macOS have adopted some microkernel features (although their kernel architectures are also partly monolithic, which is why macOS is usually described as having a hybrid kernel architecture), but Linux has retained a monolithic architectural style throughout its history.
History of the Linux Kernel
The Linux kernel was developed beginning in 1991 by Linus Torvalds, who at the time was a programmer in Finland in his early twenties. Torvalds wanted to practice his programming skills. He also wanted to create a kernel that would support a Unix-like operating system that he could run on a PC with an x86 computer chip architecture.
Although other Unix-like kernels for x86 PCs existed at the time, they either cost money (which Torvalds didn’t like) or weren’t compatible with his specific type of PC.
So, Torvalds wrote the Linux kernel on his own, then shared a link to its source code on Usenet (a service that, at the time, worked like an online forum-based discussion platform). From there, other developers began contributing code to enhance Torvalds’s kernel. This Internet-based collaboration gave birth to Linux as an open source project.
By the mid-1990s, Linux’s feature set was sufficiently complete for Linux to serve as the basis for a full-fledged operating system. By combining Linux with the software developed by the GNU project (whose efforts to develop its own free and open source kernel had stalled), people began running production servers and PCs.
This turned Linux into a competitor with Windows, which at the time dominated the markets for both PC and server operating systems. Linux never gained much of a following as a kernel for PCs, but it did establish itself as a widely used server operating system.
Linux is also now massively important in cloud computing environments, where it powers many of the underlying host servers.
Linux Kernel Features
The most important Linux kernel features are the same as those you’d find in any modern operating system:
- Resource management: Linux manages hardware resources and makes them available to processes. The Linux kernel can be configured to allocate resources in a variety of ways based on different priorities; for example, you can use the nice program on Linux to allocate different levels of access to CPU resources to different programs.
- Input/output: The Linux kernel provides input/output support so that devices can read and write data from both persistent and non-persistent storage.
- System calls: The kernel allows programs to make system calls, which are requests for resources managed by the kernel. For example, to start a new process, an application would typically need to make a system call.
- Device management: The kernel allows programs to interface with various types of devices integrated within or connected to a computer, such as hard disks, network interfaces, and display adapters. In most cases, devices are managed using hardware modules, which can be loaded dynamically into the kernel.
In addition to these basic features, modern versions of Linux offer special features and types of functionality that are unique to Linux, such as:
- The Kernel Virtual Machine: The Kernel Virtual Machine, or KVM, is a virtualization framework built into Linux, which makes it possible to run virtual machines directly in the kernel (although you typically need additional tools to access and manage the KVM functionality).
- LXC: LXC is a technology in Linux that supports running programs in isolated, containerized environments without traditional virtualization. LXC was originally the basis for Docker containers, although Docker now uses a different containerization technology in most cases.
- Extended Berkeley Packet Filter: The Extended Berkeley Packet Filter, or eBPF, is a way to run sandboxed programs directly in the Linux kernel. This feature is relatively new and is still evolving, but because it provides a highly secure and highly efficient means of managing resources within Linux, eBPF offers a lot of promise for use cases related to monitoring and security.
In most other operating systems, you’d have to rely on third-party extensions or add-ons to provide these types of features. But with Linux, they are available by default, as long as the features are enabled when your kernel is compiled. (Compiling is the process of turning source code into code that a computer can execute, and many of Linux’s features can either be enabled or disabled when developers compile the kernel. This modular approach makes it possible to build lightweight Linux kernels where desired by choosing not to enable features you won’t use.)
Conclusion
Linux is a powerful technology, but it’s also a technology that tends to be misunderstood. Linux itself is only a kernel, not a complete operating system.
And although the Linux kernel provides access to a wide range of features that you won’t find in most other operating systems, those features have to be turned on in your kernel if you want to use them.