Kahibaro
Discord Login Register

4.3.1 What is the kernel?

Big-picture view: where the kernel fits

The kernel is the core program of an operating system that runs with the highest privilege and mediates all interaction between software and hardware.

User programs (your shells, browsers, databases, containers, etc.) never touch hardware directly. Instead, they:

  1. Run in user space (restricted mode).
  2. Ask the kernel (in kernel space) to do privileged work through system calls.
  3. The kernel:
    • Schedules CPU time,
    • Manages memory,
    • Talks to devices,
    • Enforces permissions and isolation.

Visually:

The Linux kernel is a single, continuously running program that starts very early in the boot process and only stops when the system shuts down or reboots.

Core responsibilities of the Linux kernel

1. Process and thread management

The kernel decides who runs when on the CPU.

Key ideas you should connect with the kernel:

2. Memory management

The kernel manages all physical RAM and presents each process with the illusion of its own large, contiguous memory space.

Main roles:

3. Device and driver management

The kernel is the layer that knows how to talk to hardware.

From user space, you typically do not talk to drivers directly; you use system calls (read, write, ioctl, send, recv, etc.) and libraries, and the kernel routes those operations to the right driver.

4. Filesystems and storage

The kernel provides the abstraction of files and directories on top of raw storage devices.

The entire concept of “everything is a file” is realized and enforced by the kernel’s VFS and filesystem drivers.

5. Networking

Linux networking is implemented almost entirely inside the kernel.

6. Security, isolation, and resource control

The kernel is the final authority on what any program is allowed to do.

The Linux kernel’s design style

Monolithic kernel with modularity

Linux is a monolithic kernel:

However, Linux is also modular:

From a conceptual point of view: it’s monolithic by architecture, modular by implementation.

Kernel vs user space ABI

The kernel provides a relatively stable ABI (Application Binary Interface) to user space:

As an admin or developer, you mostly care about:

How users and applications interact with the kernel

System calls

System calls (syscalls) are the boundary between user programs and the kernel:

Most higher-level functions you use in C or other languages (like fopen, printf, etc.) are provided by libraries (e.g. glibc) and internally make system calls when needed.

Pseudo-filesystems: `/proc` and `/sys`

The kernel exposes information and controls to user space via special virtual filesystems:

When you read or write these files, you are indirectly asking the kernel to provide data or change settings.

ioctls and netlink

Beyond regular read/write:

Linux kernel as a project and artifact

Versioning and releases

The Linux kernel is developed as an open-source project, mainly at kernel.org.

Version numbers generally follow:

$$
\text{major.minor.patch}
$$

For example:

Distributions often:

Understanding that you are usually running a distribution kernel, not a raw upstream kernel, is important when tracking features and bugs.

Configuration and build-time choices

Before compilation, the kernel is configured:

This configuration profoundly shapes what your kernel can do and how it behaves. Compiling and customizing a kernel is handled in a separate chapter, but conceptually:

Why the kernel matters for advanced work

Even if you never touch kernel code, understanding what the kernel is helps you:

In later chapters on kernel modules, parameters, and custom kernels, you’ll work more directly with specific mechanisms. Here, the key takeaway is:

Views: 74

Comments

Please login to add a comment.

Don't have an account? Register now!