Slashdot Mirror


Linux Core Kernel Commentary

How would you dip your feet in the water, learning enough to start dabbling with kernel development? Scott Maxwell might end up as the guide for a fresh batch of aspiring programmers, with his Linux Core Kernel Commentary. Starting with a lesson on the history and philosophy behind free software, you can learn enough to start contributing on your own.

Linux Core Kernel Commentary author Scott Maxwell pages 575 publisher Coriolis Open Press rating 9 reviewer chromatic ISBN 1576104699 summary In the spirit of Lions' Commentary on Unix, Scott Maxwell takes readers on a tour of the basic architecture and workings of the Linux kernel. The massive tome has nearly 40,000 lines of code from the x86/arch branches of the Linux kernel. That works out to two columns on each of over 400 pages. It's mostly free of annotations, except for small arrows referring to the commentary on that section. The commentary takes up the rest, at three columns per page. The architecture dependent functions target x86 code, and the core features (memory management, processes, scheduling, signals and threads, procfs) are covered.

What's to Like? Most interesting for me was the "a-ha!" factor. The normal chapter flow describes the subsection in general terms (memory management is designed to do such and such, with these issues), moves to the important data structure, and then walks through the vital functions for that section, stopping here and there to explain peculiarities and subtleties of the code. There's rough going in a few spots, but there are occasional moments of insight where the solutions come in to clear focus. (This happened most often for me in the SMP chapter, as the discussion of locks is particularly good.)

Maxwell manages to avoid unexplained jargon for the most part, though he invents names for implied kernel idioms. Even while dealing with highly specific topics, readers won't need a background in OS design to understand the text. Good C skills will help, as well as assembly, though the latter is explained in greater detail than the former.

The author also takes pains to point out flaws and possible optimizations in the kernel, though he often concludes that the route taken is the best for various reasons. Another theme is the tradeoffs necessary between speed, clarity, compatibility and portability. Finally, as kernel 2.4 will be out shortly, Appendix B discusses the modifications in the 2.3 tree as it went to press.

What's to Consider? As space is limited, Maxwell sometimes skips some interesting details -- especially in latter chapters. Unfortunately, phrases like "There's not room to cover this" or "that is out of the scope of this book" pop up now and then. I definitely wanted more.

Two other small nitpicks may be corrected in a future version. First, it would have been nice if the current filename was listed on each page of the source code listing, just for reference. Second, flipping back and forth between commentary and code was tricky, especially in a book of this size. Perhaps splitting things into two books would help? Serious students might find it easier to browse the code from the CD-ROM, which includes the code for kernel versions 0.01, 2.2.5, 2.2.10, 2.3.12, and the entire code of the first section, numbered as it appears.

The Summary This could serve as a textbook in an OS design class. Supplemental material will be necessary (file systems not covered for example, nor are drivers). Perhaps paired with a more theoretical text, it could form the basis of an intermediate computer science class.

The utility is not limited to students, though. Anyone wondering where to start understanding the Linux kernel would do well to consider this book.

Buy this book at ThinkGeek.

Table of Contents
  1. Linux Core Kernel Code
  2. Linux Core Kernel Commentary
    1. Introduction to Linux
    2. A First Look at the Code
    3. Kernel Architecture Overview
    4. System Initialization
    5. System Calls
    6. Signals, Interrupts, and Time
    7. Processes and Threads
    8. Memory
    9. System V IPC
    10. Symmetric Multiprocessing (SMP)
    11. Tunable Kernel Parameters
  3. Appendices
    1. Linux 2.4
    2. GNU General Public License

4 of 56 comments (clear)

  1. It's a good book... by ceswiedler · · Score: 5

    ...except for the shipping charges. I agree that the 37k lines of source may be a waste of trees, but it is easier to flip through a book sometimes.

    A good companion to this book is Advanced Programming in the Unix Environment. I found myself wondering exactly why some kernel routines were implemented the way they were, until I read up on them in APUE. It's important to understand the "user" interface to the kernel when you're reading this book.

    Knowledge of stuff like assembly language (GNU's version of course) and low-level stuff like IRQs/interrupts, memory segmentation, and device IO is important--like the review says, he doesn't go into those details. Higher-level stuff like scheduling, file-system calls, and IPC is dealt with very well.

  2. The Lions Book might be a better place to start. by XLawyer · · Score: 5
    I haven't read this book yet, although the review makes me want to pick up a copy.

    OTOH, if you're not familiar with how operating systems work, I think you'd do better to start with John Lions's Lions' Commentary on Unix: With Source Code, (Peer to Peer Communications 1996), ISBN 1573980137.

    This book, usually called "The Lions Book," has the full source code for an early version of Unix, followed by Professor Lions's annotations. The source and commentary are comparatively short (about 300 pages, compared to 400 pages for the Linux source alone), largely because the kernel it describes is a good deal smaller than the current linux kernel. This means it's also a lot simpler than the linux kernel.

    If you're already comfortable with reading complex sources, and you know a lot about operating systems, then give Maxwell's book a try. But I suspect a lot of people would be overwhelmed by it, and the Lions Book is a better place for them to start.

  3. Lousy formatting kills the effect by Mechanist · · Score: 3
    Or so I expect. I don't have this book, but I do have "Apache Server Commentary", from the same series, which uses the same layout as this book.

    While the commentary might be good, the book's half-assed ripoff of the format of the old Lions commentary kills the usefulness of the book:

    • Dividing the source code from the commentary makes for an awkward experience, since you must constantly flip back and forth to get any sense of what's going on.
    • Despite the book's gargantuan size, it's not even close to complete. The main portion of the Apache source contained 17 source files when this book was written-- but only 3 are covered in the book.
    • The commentary often goes hundreds of lines without a hint as to what's going on
    • There's no cross-reference, and the index is useless. Meaning that if you want to find out about a specific function-- say, you saw a call to it, and want to see its code-- there's no easy way to find it.


    I always thought that Lions' commentary used that format due to AT&T licensing restrictions on the source code, or some other AT&T policy. But Coriolis had no such excuse in writing these books. With open source projects, this layout stinks.

    On the whole the book was only marginally more convenient than printing my own copy of the source code. I would not recommend it. Better to get cscope (free now!) and a different reference. [For Apache, try O'Reilly's "Writing Apache Modules", with decent API docs.]

    --
    And you may ask yourself, well, how did I get here?
  4. "The Linux Kernel": excellent and free by AxelBoldt · · Score: 3
    Linux is free and so is its documentation. If you want to understand the basic algorithms and data structures of the Linux kernel, start with David A Rusling's excellent free book "The Linux Kernel", put out by the Linux Documentation Project.

    --