EU
  
You are currently viewing the European Union version of the site.
Would you like to switch to your local site?
19 MIN READ TIME

WHAT MAKES THE KERNEL TICK?

Linux is just a kernel, but as Jonni Bidwell discovers there’s an awful lot going on in there…

E xplaining what Linux is to senior management types can sometimes be tricky. An operating system, a monolithic kernel written in C, or a way of life are all valid answers. But so too is, to paraphrase Morpheus from The Matrix, “no one can tell you what Linux is, you have to experience it for yourself”. Fortunately, the fact you’re reading this magazine suggests you have some interest in Linux, maybe even some experience, and so we’ll treat you to a kernel deep-dive the likes of which would have management quaking in their boots.

The Linux Kernel is at the heart of all your favourite distros. It’s the interface between hardware and software, so it contains all the device drivers, networking stacks and weird protocols required to get your system from the BIOS into a usable state (via the bootloader), and hopefully keep it that way. It has direct access to the CPU and memory, so when userspace programs want to access those, they do so via kernel calls. The kernel then dutifully allocates memory, gets the CPU to do the required sums, and gives back the requested result.

Windows and macOS have kernels, too – it’s just that those kernels are much more tightly coupled with their respective OSes. Android uses the Linux Kernel, but buried deep beneath layers of Java-flavoured abstractions that make it utterly unlike a conventional Linux distribution. But enough about lesser OSes. We’re here to find out what makes the Linux kernel tick, how it has developed and even how to make it tick faster. So without further ado, on with the show!

How does the kernel work?

While you’re reading this, your computer’s kernel is a hive of activity.

When you power on your Linux box the BIOS or UEFI jump into life and do all kinds of checks and initialisations to get it into a state capable of running an OS. Once that’s done it hands over to the bootloader (GRUB or systemdboot, say) whose job is to load the kernel into memory, start an initial RAM disk or filesystem (initrd or initramfs) and then hand over to the init process, known as PID1 since it’s the first process to start. And also the process that spawns all other processes.

It’s not always strictly necessary to use an initrd, but most distros do this because it simplifies the process of accessing the root filesystem, which might need certain drivers to be loaded before it can be accessed. This so-called early userspace contains everything required to detect hardware, load modules and mount the root filesystem. Oh, and if you’ve ever used the hibernate function, which dumps the current system state to disk, then it’s the initramfs that ensures that image can be read when you power the system back on.

We’ve already skipped way past the kernel by this point, but that doesn’t matter, because from the moment it’s loaded the kernel becomes the gatekeeper of system hardware. When your initrd goes looking for a filesystem with a particular UUID, it does so via the kernel. When it wants to query what kind of filesystem that is, it does so via the kernel. The filesystem (for example, ext4 or btrfs) and interface (SCSI or ATA, say) modules are packed into the initramfs so they can be loaded (again by the kernel) and before you know it

Systemd (or whatever is your PID1) has taken over your system. Except it hasn’t, because everything Systemd and everything that comes after does is done through the kernel. Kernel calls run in a privileged mode, which is even more privileged than the root account if you like, since all root does gets vetted by the kernel too.

Unlock this article and much more with
You can enjoy:
Enjoy this edition in full
Instant access to 600+ titles
Thousands of back issues
No contract or commitment
Try for €1.09
SUBSCRIBE NOW
30 day trial, then just €11,99 / month. Cancel anytime. New subscribers only.


Learn more
Pocketmags Plus
Pocketmags Plus

This article is from...


View Issues
Linux Format
September 2021
VIEW IN STORE

Other Articles in this Issue


WELCOME
WELCOME
Tux turns 3O
REGULARS AT A GLANCE
Valve announces the Linuxpowered Steam Deck
Upcoming handheld PC will use SteamOS, which is now based on Arch, and it could have big benefits for Linux gaming
Audacity drama continues
Anger over Audacity’s use of telemetry reaches boiling point as 4chan gets involved
Linux Foundation in game engine push
The foundation teams up with the likes of Adobe and Red Hat to design a 3D game and simulation engine
UPSTREAM FIRST
Gustavo Padovan Kernel team lead at Collabora, helping
FIRST STEPS
Keith Edmunds is MD of Tiger Computing Ltd,
SOFTWARE
GIMP seeks funding
Checkmate, GPL abusers!
Chess engine Stockfish files lawsuit against ChessBase over GPL 3 violations
Linux Foundation Training Scholarship winners announced
500 scholarships announced for this year – the highest yet
Distro watch
What’s down the side of the free software sofa?
IMPROVING INCLUSIVITY
Matt Yonkovit is Percona’s Head of Open Source
ACORNS TO OAKS
Jon Masters has been involved with Linux for
KERNEL WATCH
Jon Masters summarises the latest happenings in the Linux kernel, so that you don’t have to
Answers
Got a burning question about open source or the kernel? Whatever your level, email it to lxf.answers@futurenet.com
MAILSERVER
WRITE TO US Do you have a burning Linuxrelated
On the disc
Discover the highlights from this month’s packed DVD!
Historic distros
ARTEFACTS AND RELICS MIN SPECS: A REALLY OLD
CUSTOMISE MINT 20CUSTOMISE MINT 20
Explore desktop options with the latest release of Mint 20.2 and get the best of all worlds
LINUX FORMAT
Future Publishing Limited, Quay House, The Ambury, Bath,
REVIEWS
Linux Kernel 5.14
Mayank Sharma celebrates 30 years of Linux by examining its beating heart
Slackware 15
Mayank Sharma has a childhood flashback to seeing his dad in the same predicament as he finds himself after all these decades
Debian GNU/Linux 11
Mayank Sharma can’t help but marvel at one of the oldest Linux distros, which continues to be as riveting as it was almost three decades ago
Fedora 35 Rawhide
Mayank Sharma is pleasantly surprised to discover that this distro, which can trace its roots back to the early days of Linux, hides another one in plain sight
OpenSUSE
Mayank Sharma is glad that being able to correctly capitalise its name isn’t a requirement for running the distro that’s almost as old as Linux itself
Mageia 9
Mayank Sharma remembers Linux-Mandrake 5.1 for sowing the seeds of his complex relationship with KDE. How relevant is its successor in 2021?
Arch Linux
Mayank Sharma finds himself at that juncture in his life where he has the time to appreciate Arch, but not the patience to use it as his daily driver
ROUNDUP
Terminal browsers
Web browsers are heavy on resources and hard to tweak. Mats Tage Axelsson identifies five that you can customise to your heart’s content
Installation considerations
Some of these programs need to be compiled from source
Use and capabilities
Since you’re in a terminal, are the limitations too much to stomach?
Usability straight out of the box
How painless is first-time use?
Graphics capability
Graphics aren’t vital but remain of interest when using a terminal browser
Modern sites, JavaScript and more
Without JavaScript, many web sites look awful or simply don’t work
Functions and features
These browsers are designed to be agile – you add your own features
Working with other programs
When you choose one of these browsers, you end up wondering how to handle edge cases
The Verdict
Terminal browsers
CELEBRATE 30 YEARS OF LINUX!
How a 21-year-old’s bedroom coding project took over the world and a few other things along the way
Pi USER
Pi Foundation boosts computer education
Research project aims to further enhance the stellar educational outcomes from the Pi Foundation
PiStorm Amiga
Kit back from the dead
Real USB booting
Firmware update required
GENEROUS COMMUNITY
Dave James is an engineer in the Canonical
Raspberry Pi PoE+ HAT
Les Pounder thought the PoE+ HAT was new headwear inspired by the dashing Star Wars hero Poe Dameron. Unfortunately, it is not
Set up Sense HAT inputs in Scratch 3
Les Pounder shows how to obtain data and control sprites using the Sense HAT add-on board with Scratch 3
Turn your Raspberry Pi into a cloud server
NEXTCLOUD
TUTORIALS
Manage files and more
Midnight Commander can do more than just copy, move or delete files. Some would argue that it’s as versatile as Shashank Sharma.
Sharpen your desktop publishing skills
Aspiring media mogul Nick Peers reveals how to design newsletters, flyers and more with Scribus, the powerful open-source DTP tool.
How to run classic distros with QEMU
QEMU
Build a custom digital signage system
Discover how to create a digital signage display for an open source conference using Xibo digital signage and the help of Matt Holder.
Tutorials
Read RSS feeds direct from the terminal
Focus on what’s important in the world and cut out all those cat meme distractions with Neil Mohr and a terminal-based text-only news reader
Maximise the power of VirtualBox networking
Stuart Burns builds upon the powerful components of advanced VirtualBox networking with this second instalment of stress-saving tips
HOTPICKS
Welcome
The original issue 1 HotPicks, still going strong 21 years later!
VLC
Version: 3.0.16 Web: www.videolan.org/vlc W e think there’s
Ksnip
Version: 1.9.0 Web: https://github.com/ksnip/ksnip No other software is
Waterfox
Version: G3.2.3 Web: www.waterfox.net Imagine Firefox with a
Far2l
Version: v2021-06-30_alpha Web: https://github.com/elfmz/far2l The quest for the
G’MIC
Version: 2.9.8 Web: http://gmic.eu Get creative in image
OpenSnitch
Version: 1.3.6 Web: https://github.com/ evilsocket/opensnitch No outgoing network
WinXP
Version: GIT Web: https://winxp.vercel.app S ome may wonder
OpenTTD
Version: 1.11.2 Web: www.openttd.org The ideal sea port
0 A.D.
Version: 0.24 Web: https://play0ad.com Our Romans are peacefully
Lutris
Version: 0.5.8 Web: https://lutris.net Collect all your games
KDE Connect
Version: 21.04 Web: https:// kdeconnect.kde.org Control your Android
CODING ACADEMY
Build a software analysis Gitlab pipeline
In the second part of our web application security series, Tim Armstrong takes us through the essentials of software composition analysis
Sliding puzzles with Pygame and Python
PYTHON
Chat
X
Pocketmags Support