Linux//Origins

the machinekernel 7.3.5

How the kernel works

The kernel is the only program that runs with full access to the hardware. Everything else — your shell, your browser, your compiler — asks it for favours through a small, stable interface. Click any layer to see what it does.

The stack

Read it from the top down: your program is furthest from the metal, the drivers are closest. Each boundary exists to turn something complicated into something simple — or to stop a mistake in one place from damaging another.

What happens when you read a file

cat welcome.txt is a program calling read() in a loop. Step through what the kernel actually does with that request.

syscall trace 01 / 06

1 · userspace calls read()

The same six steps cover almost every "why is this slow?" question: cache hit, cache miss, metadata lookup, device queue, or scheduling stall.

Scheduling: who runs next

A CPU core executes one thread at a time. The scheduler's job is to pick the next one often enough and fairly enough that interactive programs feel instant while batch work still finishes.

Linux runs a completely fair scheduler family (EEVDF replaced CFS in 6.6) built on a simple idea: track how much CPU time each runnable task has received, weighted by its nice value, and always run the task that has received the least. Interactive tasks that sleep often accumulate little time, so they are chosen immediately when they wake.

  • nice (-20 to 19) shifts the weight. Lower is more CPU; only root can go negative.
  • Real-time policies (SCHED_FIFO, SCHED_RR) bypass fairness entirely for tasks that must not wait.
  • cgroups let a whole group be given a share, so one container cannot starve another.
  • CPU affinity pins a task to specific cores, which matters for cache locality and for isolating latency-sensitive work.

Memory: virtual, lazy, cached

Every process sees its own contiguous address space. That is a lie maintained by the memory management unit: pages are mapped to physical frames on demand, and the mapping is what enforces isolation between processes.

  • Virtual memory means a process can be given more address space than the machine has RAM, and can never address another process's memory.
  • Demand paging means malloc is cheap — pages are allocated when first touched, not when requested.
  • The page cache uses otherwise idle RAM to hold file contents. This is why "free" memory looks low on a healthy Linux machine, and why free -h reports available separately.
  • Overcommit and the OOM killer: the kernel usually grants allocations it cannot guarantee, and when memory truly runs out it kills a process by heuristic. The Killed message in a log is almost always this.
the beginner trap

Seeing 15.6 GB total and 0.3 GB free is normal. Read the available column. Cache is memory doing useful work, and it is reclaimed instantly when a program needs it. Try free -h in the lab →

Isolation without virtual machines

A container is a process — or a tree of them — that has been given a restricted view of the system. Three kernel mechanisms do the work:

  • Namespaces control visibility: PID, mount, network, IPC, UTS, user, cgroup and time. A process in a new PID namespace sees itself as PID 1.
  • cgroups control resources: CPU shares, memory limits, I/O weight, and accounting.
  • Capabilities, seccomp and LSM control permission: dropping root-like powers, filtering system calls, and applying policy (SELinux, AppArmor).

There is no hypervisor and no second kernel, which is why containers start in milliseconds and share the host's page cache. The trade-off is a shared kernel: a kernel bug is a shared risk, which is why seccomp profiles and user namespaces matter.

Modules, drivers and the "monolithic but modular" claim

Linux is monolithic: one kernel address space, direct function calls between subsystems, no message passing between servers. It is also modular: most drivers and filesystems can be loaded and unloaded at runtime.

That combination is the reason it can support an enormous range of hardware without the performance cost of a microkernel — and the reason a bad driver can crash the machine. Tools you will meet: lsmod, modprobe, dmesg, and /proc/modules.

How the kernel is built by other people

Roughly ten changes an hour, a release every eight to nine weeks, and thousands of contributors a quarter. The process that makes that possible is unusually simple:

  1. Subsystem maintainers collect patches in their own git trees.
  2. During the two-week merge window, Torvalds pulls those trees.
  3. Weekly release candidates accept fixes only — no new features.
  4. A stable release ships; stable and longterm branches then receive backported fixes.

The longterm branches are what distributions ship. kernel.org/releases lists the current six and their projected end-of-life dates.

The version ladder

Major numbers are milestones of scale, not redesigns. The dates are release dates.

Selected kernels, 1991–2026
VersionReleasedWhy it is on this list
0.0117 Sep 1991First public release, 10,239 lines
1.014 Mar 1994Networking, VFS, credible Unix
2.09 Jun 1996Symmetric multiprocessing
2.617 Dec 2003New scheduler and the modern release process
3.021 Jul 2011Numbering reset; the cloud era begins
4.012 Apr 2015Live patching, containers everywhere above it
5.03 Mar 2019Numbering milestone, AMD and ARM server growth
6.02 Oct 2022Cloud-native kernel work
6.111 Dec 2022Rust support merged
6.1217 Nov 2024PREEMPT_RT in mainline; longterm
6.1830 Nov 2025Newest longterm, projected to Dec 2028
7.012 Apr 2026First 7.x kernel
7.318 Oct 2026Current stable series (7.3.5, 17 Nov 2026)