Understanding Linux: The Kernel Perspective
$34.99
Minimum price
$47.99
Suggested price

Understanding Linux: The Kernel Perspective

Covers Linux Kernel 6.x

About the Book

The book “Understanding Linux: The Kernel Perspective” is a guided, practical exploration of how the kernel operates—without getting lost in the weeds of full-scale kernel development. The Linux kernel is highly efficient but deliberately hidden from casual users, making it easy to overlook. We focus on what matters most for conceptual clarity and practical insight. We start by introducing the Linux kernel and its source code, showing how it fits between user-space applications and hardware. You'll learn how to build and insert loadable kernel modules—small, self-contained units of kernel code—into a running system. These modules are central to a series of hands-on Kernel Exercises that reveal how core kernel features work in practice. Chapters cover the topics such as:

  • Processes – including how the kernel starts user space, what ELF binaries are, and how processes are tracked through kernel data structures.
  • System calls – how user programs invoke kernel services, with examples like execve() and fork().
  • Memory – including virtual memory, memory mappings, and the kernel's view of memory layout.
  • Filesystems – covering inodes, mounting, pseudo-filesystems like procfs, and interaction with block devices.
  • Networking – examining how the kernel handles packets, protocols, and connection tracking via the Netfilter framework.

Example Kernel Exercises include printing the process tree, analysing ELF headers, listing virtual memory areas (VMAs), creating custom procfs entries, and inspecting TCP/UDP network packets. If you're an intermediate Linux user aiming to become an expert with a deep understanding of how Linux works, this book is for you. While the book follows a logical progression, each section is self-contained and can be read independently, making it easy to jump to topics of interest without prior chapters.

About the Author

Vladimir Likic
Vladimir Likic

Vladimir Likic is the author of the book "Understanding Linux: The Kernel Perspective" available from LeanPub: https://leanpub.com/linuxkernel

Table of Contents

  • Prologue
  • Introduction
    • What is the Linux kernel?
    • Kernel source: a double-edged sword
    • Kernel and applications: a first approximation
    • The kernel source code
    • Kernel Exercise 1.1: Getting the kernel source code
    • Kernel space, user space, and system calls
    • Summary
  • Kernel modules
    • Why kernel modules matter
    • Kernel Exercise 2.2: Building your first kernel module
    • Kernel Exercise 2.3: Making the first kernel module more flexible
    • Kernel Exercise 2.4: Passing a parameter to a kernel module
    • Kernel Exercise 2.5: Pseudo filesystems sysfs and procfs
    • Summary
  • Processes
    • init, the first user space process
    • Kernel Exercise 3.1: Find out how kernel starts /sbin/init
    • Executable files
    • ELF files
    • ELF of a simple program
    • A closer look at the ELF header
    • Processes
    • Kernel Exercise 3.2: Process descriptor
    • The user view of processes: /proc directory
    • Pipes
    • The fork bomb
    • Kernel Exercise 3.4: Loop through the task list, print processes
    • Kernel Exercise 3.5: Print the PID and PPID for a process
    • Kernel Exercise 3.6: Find a process by PID
    • Summary
  • System calls
    • Invoking kernel services
    • Kernel Exercise 4.1: the execve system call in the kernel code
    • Invoking program execution with the C function execve()
    • Forking the process: the C function fork()
    • excve() system call
    • The hash-bang directive
    • Kernel Exercise 4.2: A simple Unix shell in C
    • Summary
  • Memory
    • Virtual memory
    • A process view of memory: the heap and the stack
    • Memory addresses and pages
    • Virtual address space
    • Virtual memory areas (VMAs)
    • Virtual memory for many processes simultaneously
    • The kernel memory structures
    • Kernel Exercise 5.1: Print the VMA start/end address
    • Kernel Exercise 5.2: Print VMAs of a process
    • Kernel Exercise 5.3: List file-backed VMAs
    • Summary
  • Filesystems
    • Understanding filesystems
    • inodes
    • Storage subsystem: layer interaction example
    • Pseudo-filesystems
    • Block device layer
    • Filesystem types and features
    • Mounting and mount namespaces
    • Kernel Exercise 6.1: Filesystem metadata inspection with inodes
    • Kernel Exercise 6.2: Create a procfs file entry
    • Kernel Exercise 6.3: Pipes, the filesystem perspective
    • Summary
  • Networking
    • Networking in the Linux kernel
    • The TCP/IP protocol
    • Transport layer packets
    • Network layer packets
    • Domain Name Service (DNS)
    • User tools for network management
    • Sockets
    • Kernel networking stack
    • Netfilter
    • Kernel Exercise 7.1: Capture network packets with netfilter
    • Kernel Exercise 7.2: Identify IPv4 packet types
    • Kernel Exercise 7.3: Logging source/destination ports for TCP and UDP packets
    • Summary
  • Appendix 1: Kernel process descriptor
  • Appendix 2: Unix shells and bash
    • The bash shell
    • The rich history of Unix shells
    • Doing two different things at once
    • A closer look at how bash executes programs
    • Insights from the bash source code
    • The bash protocol for program execution
  • Appendix 3: The story of Linux
    • From a student’s hobby to global scale
    • What, Unix culture?
    • Open Source
    • The history of Unix
    • Research Unix: the origins
    • Berkeley Unix (BSD)
    • Research Unix: the late years
    • The story of vi
    • VAX Unix
    • The Unix wars
    • Unix and Microsoft
    • Linux is the evolution of Unix
    • FreeBSD: Linux’s lesser-known relative
    • The POSIX standard
  • Appendix 4: Instruction for obtaining the code for Kernel Exercises
    • How to Extract the Kernel Exercises
  • About this book
  • Notes

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub