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 full-scale kernel development. The Linux kernel is highly efficient but deliberately hidden from casual users, making it easy to overlook, and we focus on what matters most for conceptual clarity and practical insight. You will 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 exercises that reveal how core kernel features work in practice. The book cover the topics such as:

  • Unix shells – including how bash executes commands
  • 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 management – 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.

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. The code presented in the book is available or download (instructions provided within the book).

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?
    • The kernel source: a double-edged sword
    • Kernel and applications: a first approximation
    • Exercise 1.1: Getting the kernel source code
    • Kernel space, user space, and system calls
    • Summary
  • Kernel modules
    • Why kernel modules matter
    • Exercise 2.1: The tools for kernel modules
    • Exercise 2.2: Building your first kernel module
    • Exercise 2.3: Making the first kernel module more flexible
    • Exercise 2.4: Passing a parameter to a kernel module
    • Exercise 2.5: Pseudo filesystems sysfs and procfs
    • Summary
  • Processes
    • Process creation magic
    • Forking the process: the C function fork()
    • Executing an external program: the C function execve()
    • Exercise 3.1: A simple Unix shell in C
    • How bash executes programs
    • init, the first process
    • Executable files
    • ELF files
    • Exercise 3.2: ELF of a simple program
    • A closer look at the ELF header
    • Processes
    • Process descriptor
    • The user view of processes: /proc directory
    • Pipes
    • The fork bomb
    • Exercise 3.3: Process descriptor source code
    • Exercise 3.4: Loop through the task list, print processes
    • Exercise 3.5: Print the PID and PPID for a process
    • Exercise 3.6: Find a process by PID
    • Exercise 3.7: Find how the kernel starts init
    • Summary
  • System calls
    • Invoking kernel services
    • Exercise 4.1: the execve system call in the kernel code
    • execve() system call
    • fork() system call
    • The hash-bang directive
    • 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
    • Exercise 5.1: Print the VMA start/end address
    • Exercise 5.2: Print VMAs of a process
    • 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
    • Exercise 6.1: Filesystem metadata inspection with inodes
    • Exercise 6.2: Create a procfs file entry
    • 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
    • Exercise 7.1: Capture network packets with netfilter
    • Exercise 7.2: Identify IPv4 packet types
    • 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
  • 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 exercises
    • How to Extract the 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