Linux Learning Resources

Recently, my teacher invited our lab members to share their experience on how they learned Linux kernel along the way, but no one gave a clear path. Of course, Linux kernel is probably the most complicated large scale software in the world. Every member in the lab said it's just trial and error that make them know more about Linux kernel.

However, I think everyone once knew how they conquered the difficulty, but forgot it overtime and didn't write them down. So, I'm gonna record all of the useful resources I found and share them in this blog post, and hope it helps newbies to learn faster.

Basics

Everyone knows that basics are basic and important. Teach Yourself Computer Science gives some recommendations for CS textbooks if you're interested, but in this post I'll focus on those aspects relevant to Linux kernel.

Operating Systems

OSTEP cover

Operating Systems: Three Easy Pieces (OSTEP) is my favorite OS textbook because it's practical and deals with engineering problem. It's crucial that we learn how real OS works instead of just knowing the concepts if you really want to learn Linux kernel.

Putting the "You" in CPU are a series of articles about multitasking with fork and exec on Linux. It's easy to read yet very informative.

Computer Architecture

CSAPP cover

Linux kernel has strong connection with computer architecture because a OS directly control the CPU and other hardware. Again, practicality is important, so I recommend Computer Systems: A Programmer's Perspective. I knew this book from jserv and got one Chinese copy from Tenlong, and I would say it's a good deal. If you are a Taiwanese student, you can buy books at Tenlong with 50% off if you pay with 文化幣.

This book talks about how computer works in detail. For example, chapter 2 includes IEEE 754 floating point encoding and chapter 4 includes CPU pipelining and loop unrolling. These are real problems in Linux kernel, so we definitely need to learn them.

Linux

Linux 核心設計/實作 by jserv (黃敬群) is the most comprehensive Chinese course for Linux at the moment. The material are free and open, so everyone can learn Linux kernel at no cost. Huge appreciation to jserv! The recorded videos are not as informative as the HackMD notes, but it's still very valuable because jserv teaches you the mindset for developing (not just learning) Linux kernel.

eBPF

eBPF logo

eBPF (or BPF, these terms are used interchangeably in Linux kernel, according to Liz Rice in her book) is one of the most popular topic in Linux kernel. eBPF is a virtual machine like JVM that runs in the kernel. When the kernel hit a tracepoint (like function call), your eBPF program fires if you attach your eBPF to the tracepoint. You can then get information about what the kernel is doing, the content of data, or change the behavior of the kernel.

For more information, I highly recommend you watch the well done documentary on YouTube. It talks about the history of eBPF and the people that made it. I think this is encouraging and can feel the developers' excitement and passion.

To learn how to write eBPF programs, I'd recommend the fantastic Learning eBPF by Liz Rice.