Linux kernel
Contents
Linux kernel
The Linux kernel is a free and open-source, monolithic, Unix-like operating system kernel. It is the main component of a Linux operating system and is the core interface between the computer's hardware and its processes. It handles resource management, low-level hardware interaction, process management, memory management, and system calls.
The Linux kernel was conceived and created by Linus Torvalds in 1991. Initially, it was a hobby project inspired by MINIX, but it quickly grew with contributions from developers around the world. It is licensed under the GNU General Public License version 2 (GPLv2), which ensures it remains free and open-source.
Due to its licensing and modular design, the Linux kernel has become a foundational component for a vast array of computing systems, including Linux distributions (like Debian, Ubuntu, Fedora, Android), embedded systems, servers, supercomputers, and devices within the Internet of things.
History
In 1991, Linus Torvalds, a student at the University of Helsinki, began a project to create a simple kernel for his new PC using a 386 processor. He was dissatisfied with MINIX, a small Unix-like operating system used for teaching, and aimed to create something more capable.
He announced his project in a Usenet post in August 1991, stating it was "just a hobby, won't be big and professional like gnu". The first official version, 0.02, was released in September 1991. Early on, it benefited greatly from using GNU software (like the GCC) and libraries, leading to the common term "Linux" often referring to the entire operating system formed by the Linux kernel combined with GNU user-space tools, sometimes referred to as GNU/Linux.
The project rapidly gained contributors over the Internet, accelerating its development. The version number quickly increased, reaching 1.0 in 1994, 2.0 in 1996, 3.0 in 2011, and 4.0 in 2015. Development is now managed through a large, distributed network of maintainers and contributors coordinated by Linus Torvalds. The version control system used for the kernel source code is Git, which was created by Torvalds himself.
Design and Architecture
The Linux kernel is primarily a monolithic kernel, meaning that the entire operating system kernel runs in kernel space as a single process. This differs from a Microkernel, where core functionalities are broken down into separate processes running mostly in user space.
However, the Linux kernel incorporates loadable kernel modules, which allows parts of the kernel, such as device drivers, filesystem support, and networking protocols, to be loaded and unloaded while the kernel is running. This modularity provides flexibility, reduces the kernel's memory footprint on systems that don't need all features, and simplifies development and distribution of drivers.
Key architectural aspects include:
- **Layered Structure:** While monolithic, the kernel is conceptually organized into layers, from the low-level architecture-specific code at the bottom to the system call interface at the top.
- **Portability:** The kernel contains architecture-specific code to run on a wide range of CPU architectures (e.g., X86, ARM, MIPS, PowerPC), with an abstraction layer handling hardware differences.
- **Preemptible Kernel:** Modern Linux kernels are preemptible, meaning a higher-priority process can interrupt a currently running kernel process, improving responsiveness, especially on multi-core systems.
Key Subsystems
The Linux kernel manages the system's resources through several key subsystems:
- Process Management: The kernel is responsible for creating, scheduling, and terminating processes. The scheduler determines which process runs on the CPU and for how long, aiming to efficiently utilize CPU time and provide a good user experience (e.g., the Completely Fair Scheduler - CFS).
- Memory Management: This subsystem manages the system's RAM, allocating memory to processes, handling Virtual memory, swapping data between RAM and disk (swapping), and managing the page cache to improve disk I/O performance.
- File Systems: The kernel provides a Virtual File System (VFS) layer that abstracts the details of different filesystem types (e.g., Ext4, XFS, NTFS, FAT). This allows the same system calls to work regardless of the underlying filesystem on the disk.
- Device Drivers: Drivers are software components that allow the kernel to interact with specific hardware devices (e.g., network cards, graphics cards, USB devices, storage controllers). Many drivers can be compiled as loadable kernel modules.
- Networking Stack: This subsystem handles all network communications, implementing various network protocols (like TCP/IP, UDP, IPX) and interacting with network hardware via drivers.
- System Call Interface: This is the boundary between user-space applications and the kernel. Applications request kernel services (like creating a process, reading a file, sending data over a network) by making system calls via a defined interface.
Kernel Modules
Loadable kernel modules (LKM) are object files that can extend the running kernel's functionality. They are used to add support for new hardware or filesystems, or to add specific networking protocols without requiring a reboot or a full kernel recompile. This makes the kernel more dynamic and adaptable to different hardware configurations.
Licensing
The Linux kernel is licensed under the GNU General Public License version 2 (GPLv2). This license requires that anyone who distributes the kernel or derivative works must also make the source code available under the same terms. This ensures that the kernel remains free and open-source and encourages contributions from the community.
Development Model
The Linux kernel is one of the largest and most successful open-source projects globally. Its development follows a distributed model:
- Thousands of developers from various companies and independent contributors worldwide work on different parts of the kernel.
- Code changes are proposed through email to specific maintainers responsible for different kernel subsystems.
- Maintainers review and test the changes, then submit them up a hierarchy of subsystem maintainers.
- Ultimately, changes flow up to Linus Torvalds, who has the final say on which changes are merged into the main kernel tree.
- The entire process is managed using the Git distributed version control system.
This model allows for rapid development and review of code, making the kernel highly adaptable and robust.
Significance and Impact
The Linux kernel's portability, stability, and open-source nature have led to its widespread adoption across diverse computing domains:
- Linux Distributions: It is the core of every Linux distribution, powering desktop computers, laptops, and servers.
- Android: The Android operating system, the most popular mobile operating system globally, is based on a modified version of the Linux kernel.
- Embedded Systems: Linux is prevalent in embedded devices like routers, smart TVs, automotive systems, and IoT devices.
- Servers and Supercomputers: Linux dominates the server market and powers the vast majority of the world's supercomputers.
- Cloud Computing: It is the most common operating system kernel used in cloud environments, powering virtual machines and containers across major providers.
See Also
- Operating system
- Kernel (operating system)
- Monolithic kernel
- Microkernel
- Operating-system-level virtualization (used by Docker, LXC)
- Hypervisor (used by KVM, Xen)
- GNU Project
- Linux distribution
- Android (operating system)
- Device driver
- System call
- GNU General Public License
- Linus Torvalds
- Git
References
- Documentation/ Changes - Official kernel documentation and change logs.
- The Linux Foundation - Linux Kernel Development Report - Provides insights into kernel development activity.
- LWN.net - A major source for news and technical articles about the Linux kernel and development.
- Linus Torvalds's original Usenet post announcing the project.
- Bovet, Daniel P., Cesati, Marco. Understanding the Linux Kernel. O'Reilly Media, 2005. (A classic technical book on kernel internals)