Linux Kernel - What Is a Kernel?

study

Linux Kernel - What Is a Kernel?

ubuntu

ubuntu

What Is the Linux Kernel?

  • The core part of an operating system
  • A middle layer between HW and SW
  • As the core of the OS, it bridges hardware (HW) and software (SW).
  • The kernel manages and coordinates all resources so the programs we run can operate without touching hardware directly.

Key Components

  • Process Management (scheduling, context switching)
    • Scheduling: decides which process runs on the CPU
    • Context switching: the act of switching the running process to another one
  • Memory Management (virtual memory, pages)
    • Virtual memory: makes each process appear to have an independent memory space
    • Page: the unit that divides memory into small blocks for management
  • File System (VFS) (a layer that unifies all file systems)
    • VFS: a layer that provides a common interface over diverse file systems like ext4, FAT, NTFS
  • Device Driver (HW control)
    • Device drivers: software that lets the kernel control hardware (keyboard, disk, network card, etc.)

Inspecting Kernel Boot Logs

One way to see how the Linux kernel operates in practice is the dmesg command.

dmesg shows the logs the kernel prints while booting, including CPU, memory, and driver initialization.

Let me summarize some commands (feat. ChatGPT):

CommandDescription
uname -rCheck the currently running kernel version
uname -aFull kernel info (version, build time, arch, etc.)
cat /proc/versionKernel version + gcc/ld toolchain used to build it
sudo dmesg \\ lessView boot logs and kernel messages (requires root)
lsmodList currently loaded kernel modules
modinfo <module>Show detailed information for a specific module
strace <command>Trace system calls made by a user-space program

Give them a try in your terminal and take notes!

Hands-on

1. uname -r

bash
uname -r

Result

6.5.0-26-generic

What this means

6.5.0-26-generic is the version label of the Linux kernel currently running on this computer.

You can read the version number like this:

PartMeaningAnalogy
6Major versionA big upgrade like Android 13 → 14
5Minor versionSmall feature additions
0Patch levelBugfix level
26Distro patch number (Ubuntu’s build tag)Ubuntu-specific update
genericGeneral-purpose kernel flavorDefault flavor, not server/specialized

Put playfully, it’s like: “Linux kernel, 6th grade, class 5, number 0 — 26th revision (general track).”

2. uname -a

bash
uname -a

Result

Linux thunder 6.5.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 12 10:22:43 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

What this means

uname -a shows a one-line summary of the kernel and system.

PartMeaning
LinuxOperating system kernel name
thunderHostname (my PC’s name)
6.5.0-26-genericKernel version (same as above)
#26~22.04.1-UbuntuUbuntu’s build/release number for this kernel
SMPSymmetric Multi-Processing support (multi-core CPUs)
PREEMPT_DYNAMICPreemption mode can be adjusted dynamically
Tue Mar 12 10:22:43 UTC 2Date and time the kernel was built
x86_64 x86_64 x86_6464-bit kernel, 64-bit machine, 64-bit user space
GNU/LinuxOS composed of the GNU toolchain + Linux kernel

In short, uname -a shows at a glance “what my kernel version is, when it was built, and what environment it’s running on”.

3. cat /proc/version

bash
cat /proc/version

Result

Linux version 6.5.0-26-generic (buildd@lcy02-amd64-051) (x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 12 10:22:43 UTC 2

What this means

cat /proc/version shows how the kernel was built.

There’s overlap with uname -a, but a few differences:

PartMeaning
Linux version 6.5.0-26-genericRunning kernel version
buildd@lcy02-amd64-051Build server/user that built the kernel
x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1...)GCC version used to compile the kernel
GNU ld (Binutils 2.38)Linker (ld) version
#26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 12 ...Build number, SMP (multi-core support), PREEMPT mode, build time

In short:

  • uname -a → runtime environment information of the current kernel
  • cat /proc/version → which compiler/toolchain was used to build this kernel

3. sudo dmesg | less

  • The output runs to hundreds of lines, so it’s a bit much to include fully in a blog post.
  • Better to revisit it separately later.
  • Lets you inspect boot logs and kernel messages.
  • The later parts (driver loading, network initialization, etc.) are best covered in a dedicated post.

4. lsmod

bash
lsmod

Result (excerpt)

Module           Size    Used by
snd_usb_audio    450560  3
btusb            73728   0
uvcvideo         135168  0
amdgpu           15552512 26
rtw88_core       356352  2
thinkpad_acpi    159744  0
r8169            114688  0
nvme             57344   2

What this means

  • snd_usb_audio → USB audio device driver
  • btusb → Bluetooth USB driver
  • uvcvideo → Webcam driver
  • amdgpu → AMD GPU driver
  • rtw88_core → Realtek Wi‑Fi driver
  • thinkpad_acpi → ThinkPad-specific ACPI features driver
  • r8169 → Realtek wired LAN driver
  • nvme → NVMe SSD driver

lsmod shows which driver modules the kernel has currently loaded.

  • In lsmod, numbers like 450560 indicate the module’s size (binary size, in bytes).

5. modinfo <module>

Let’s use one of the modules above.

  • rtw88_core: core module of Realtek wireless LAN chipsets

This command prints detailed information about a specific module.

bash
modinfo rtw88_core

Result (summary)

FieldMeaning
filename/lib/modules/.../rtw88_core.ko → module file path
licenseDual BSD/GPL → license suitable for the Linux kernel
descriptionRealtek 802.11ac wireless core module
authorRealtek Corporation
dependsmac80211, cfg80211 → depends on the Linux wireless stack
vermagic6.5.0-26-generic SMP preempt ... (built kernel version/options)
parmdisable_lps_deep, support_bf, debug_mask, etc. parameters

Summary

  • rtw88_core: core module for Realtek wireless LAN chipsets
  • rtw88 → family name for Realtek Wi‑Fi drivers
  • _core → common logic shared by multiple chipset variants (rtw88_8822c, rtw88_8822ce, etc.)
  • In practice, rtw88_core loads together with chipset-specific modules (rtw88_8822c, rtw88_pci, etc.)
  • Goal: ensure Realtek Wi‑Fi cards work properly on Linux

6. strace

bash
strace ls

Result (excerpt)

execve("/usr/bin/ls", ["ls"], ...) = 0
openat(AT_FDCWD, ".", O_RDONLY|O_DIRECTORY) = 3
getdents64(3, /* 10 entries */, 32768) = 400
write(1, "hello.txt\n", 10) = 10

What this means

  • execve → start executing the ls program
  • openat → open the current directory
  • getdents64 → read directory entries
  • write → write the result to the terminal

In short: strace shows what requests a user program makes to the kernel.


Today’s Takeaways

There are many reasons to study the Linux kernel, but the biggest one for me is to deeply understand how Linux works internally.

When studying for certifications or in OS classes at school, I only knew “the kernel is the core of the OS” at a surface level. In reality, I didn’t grasp how much is happening inside.

Today, using strace was eye-opening. Even a simple command we take for granted like ls actually goes through numerous system calls and kernel-handling steps—that became visible right in front of my eyes.

On the surface it merely “shows files in the current directory,” but behind the scenes, multiple processes are allocating memory, loading libraries, and the file system and kernel are working together to get the job done.

Commands I use every day felt so obvious, yet learning that they operate through such complex mechanisms makes me appreciate the precision and sophistication of operating systems and kernels even more.