Skip to main content

Structure of the Linux Kernel

· 2 min read
Sanjeev Sarda
High Performance Developer

I learnt Linux through practice and use, it was only later that I actually studied it. Here's a TLDR note on the structure of the Linux Kernel, also covers monolithic vs micro-kernels.

Linux

If you want to learn about the kernel, one of my favourite books is "Linux Kernel Development" by Robert Love, it's a great read and I'd highly recommend it.

How is the Linux Kernel Structured?

If you think about the core functions an operating system needs to provide, it's a lot easier to understand the structure of the Linux Kernel.

We need to manage resources - CPU, memory, files and devices. We need to handle networking and ensure some kind of hardware architecuture abstraction and being able to handle modules to add functionality would also be nice.

alt text

  • Process management - scheduling, the virtual CPU abstraction
  • Memory management - virtual memory abstraction
  • Virtual file system - file system abstraction, everything is a file
  • Network stack - TCP, UDP, all things networking
  • Device drivers - allow for talking to and interfacing with hardware

Micro Kernels

The Linux Kernel is monolithic in style for performance reasons and partly for simplicity - modules also provide some flexibility. However, all the core services run in kernel space.

Micro kernels are designed to be minimal in terms of what's running in kernel space, often with things like networking and the filesystem running in user space.

All the core services communicate via IPC with more context switching due to what's running in user space.

Linux

Whilst being niche, they have a smaller amount of total code running in kernel space and so are arguably more secure.