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

Understanding Linux: The Kernel Perspective

About the Book

This book explores Linux from the kernel’s perspective. It’s aimed at informed Linux enthusiasts—those who already know their way around Linux but are curious about how its internals fit together under the control of the kernel. The Linux kernel is highly efficient and deliberately hidden from the casual user, making it easy to overlook. This book is for readers who want to understand what’s happening “under the hood” and who’d like to dabble in kernel programming without necessarily becoming kernel developers. We deliberately skip low-level implementation details—such as device drivers—that don't directly support understanding core principles. Our approach combines hands-on command-line exploration, examination of relevant kernel source code, and kernel programming through loadable kernel modules. Specially designed Kernel Exercises help readers engage with internal kernel structures. These exercises involve writing and inserting kernel modules into a running system and then observing their behaviour. Anyone with basic programming skills and access to a working Linux system should be able to follow the examples and complete the exercises.

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: Kernel modules and 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
    • 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
    • System calls invoke kernel’s power
    • 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
    • Summary
  • Networking
    • Networking in the Linux kernel
    • The TCP/IP protocol
    • Transport layer packets
    • Network layer packets
    • Domain Name Service (DNS)
    • Kernel networking stack overview
    • 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
    • The source code for struct task_struct
  • Appendix 2: A closer look how bash executes programs
    • A peek into 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: Unix shells
    • Terminal emulators
    • The bash shell
    • The rich history of Unix shells
    • Doing two different things at once
  • 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