Skip to content

Linux Foundations / Understand the system underneath ยท Step 20 of 38

Lesson: Overview of the kernelSwitch
โ† Linux Foundations

System administration

Overview of the kernel

Learn what the Linux kernel does and how it sits between your programs and the hardware.

The kernel is the core of a Linux system. It is the program that controls the hardware and shares it among everything else that runs. Strictly speaking, "Linux" is the name of this kernel. A distribution adds a shell, libraries, tools and applications around it.

Two sides of the system

Memory and execution are split into two areas. The kernel runs in kernel space with full control of the machine. Your programs, including the shell, run in user space with limited rights. When a program needs something protected, such as reading a file, it asks the kernel through a system call.

What the kernel manages

  • Processes: it creates them and the scheduler decides which one runs on each CPU.
  • Memory: it gives each process its own virtual address space and can move some pages to swap.
  • Devices: drivers let it talk to disks, network cards and keyboards.
  • Filesystems: it turns files and directories into data on storage.
  • Networking: it implements protocols such as IP and TCP.

How it is built

Linux is a monolithic kernel: drivers, filesystems and the network stack run in kernel space. It is also modular. Many parts can be built as modules and loaded only when needed, without a reboot.

Look at your kernel

bash
uname -r
6.8.0-45-generic

The number starts with the version of the upstream kernel. The suffix is added by whoever built it, so yours will look different. A distribution kernel can contain fixes carried back from newer releases, so the version number alone does not tell you which fixes are included.

bash
uname -srm
cat /proc/version
Linux 6.8.0-45-generic x86_64
Linux version 6.8.0-45-generic (builder@host) (gcc ...) #1 SMP ...

The kernel also writes messages about hardware and errors into a log:

bash
sudo dmesg | head

Some systems let ordinary users run dmesg, and others require root.

A container does not have its own kernel. It uses the kernel of the host, so uname -r inside a container reports the host's version. A virtual machine runs its own kernel.

To see processes that the kernel is scheduling, try the processes lab.

Try it

  1. Run uname -r and uname -m to find your version and machine type.
  2. Run cat /proc/meminfo | head -n 5 to see the kernel's view of memory.
  3. Run ps -e | head to list some processes.
  4. Run sudo dmesg | less and look for lines about your disk or network card. Press q to quit.

Check your understanding

Overview of the kernel

All 4 sections ยท no timer

Unlimited retries

Questions from every section are combined into one assessment. Answer them all correctly to complete the article.

Your completion saves in this browser. Sign in to sync it to your account.