Joined: 01 Sep 2004
|Posted: Sun Jul 31, 2005 8:44 pm Post subject: Book Review - Understanding The Linux Kernel
Understanding the Linux Kernel (2nd Edition)
Author(s): Daniel P. Bovet & Marco Cesati
Publisher: O'Reilly http://www.oreilly.com
Date Published: 2002
Book Specifications: Softcover, 765 pages
Category: Operating Systems
Publisher's Suggested User Level: Not Rated
Reviewer's Recommended User Level: Very Technical
Suggested Publisher Price: $49.00 US / $77.95 CDN
Amazon.com: Understanding the Linux Kernel (2nd Edition) US
Amazon.co.uk: Understanding the Linux Kernel (2nd Edition) UK
Blurb from back cover:
In order to thoroughly understand what makes GNU/Linux tick, and why it works so well on a wide variety of systems, you need to delve deep into the heart of the the operating system – that is, into the Linux kernel itself. the kernel handles all the requests or completed I/O operations and determines which programs will share its processing time, and in what order. Responsible for the sophisticated management of the whole system, the Linux kernel is the force behind the legendary Linux efficiency
Understanding the Linux kernel will acquaint you with all the inner workings of Linux but it's not just an academic exercise. You'll learn what conditions bring out Linux's best performance, and you'll see how it meets the challenge of providing good system response during process scheduling, file access, and memory management in a wide variety of environments. Knowledge is power and this book will help you makes the most of your Linux system.
This book covers all of the important areas of the Linux kernel with a focus on the reader who plans to do some development. This is not the only audience that could read this book, by any means. I've written kernel modules in the past but wouldn't plan to ever do any really substantial kernel work yet I did gain a lot from this book. If you really need to know how your system functions underneath and would like a walk through, then the authors are the guys with the map and the experience to guide you. They show a thorough understanding of the system and OS concepts in general which is invaluable as you try to find your way around the Linux kernel. They also make it clear that the the code itself is the best reference material but they can help you find your way around it and help you understand the topics that may not be obvious from the code.
Chapter Synopsis & Review Comments
Chapter 1: Introduction
Here the authors introduce Linux explain the difference between monolithic and microkernels as well the unique aspects of Linux that make it stand out from other Unix like systems. The introduction is light, but detailed enough to give you an idea of how the kernel came to be. The authors claim that you don't necessarily need programming experience to gain something from the book, I'd say this was optimistic as without C knowledge I would have been struggling with some of the concepts that come in later chapters.
Chapter 2: Memory Addressing
An excellent and detailed look at how memory works and how Linux handles it, you'll know why you have pagefaults and what page faults are when you finish this section. I haven't found a better explanation of memory in any other article or book that I have read. This will be my reference point on the matter from now on
Chapter 3: Processes
This is where the really interesting stuff begins in my opinion, we are given a view of the process and the thread from the perspective of the kernel. Ever wondered why there's always an “init” process kicking around your system, here is your explanation. We also get a good understanding of the PID and how processes are handled by the kernel.
Chapter 4: Interrupts and Exception
How interrupts work, what they do and why you want them. This is where the book becomes really heavy and if you have had trouble with the previous chapters you may want to re-read before delving into this section. Although to understand the relationship between the process and the processor this section is invaluable. The authors as with every new concept the book brings up try to diagram and detail as much of the theoretical nature as possible as well as show you how the underlying system works.
Chapter 5: Kernel Synchronisation
An important area of the kernels work is in keeping everything in sync so that race conditions do not occur. This chapter covers synchronisation in scary detail and prepares you for understanding how to write good kernel code and ensure your code will work as expected.
Chapter 6: Timing Measurements
You may not be aware of how critical timing is to the operation of a computer; There was recently a heated discussion on the kernel mailing list about changing a single value that affected time and it led to a very long thread with many of the big players passing their comments on it. It is essential to many kernel functions and is explained to us here in great detail, detail being a recurring theme in this book.
Chapter 7: Memory Management
Memory was covered earlier and here we look at managing the memory. Personally I believe these two chapters could have been combined but the authors chose to separate it. Possibly in order to separate the theory with the implementation.
Chapter 8: Process Address Space
Again an implementation separate from some theory, I'd have liked to have seen this joined to chapter 3. However it is still easy enough to follow but you may find yourself jumping back a few chapters to re-read some sections. This isn't a bad thing however, there's no real base flow to the kernel so expecting the same from a book on the subject isn't really fair on the authors.
Chapter 9: System Calls
Where would we be without system calls, yeh that's right, up userspace creek without a paddle ! Although not the best description of system calls and I'd say lacking some solid examples of their usage this chapter has all there is to know on the subject.
Chapter 10: Signals
Have you seen a “segmentation fault” before or run the command “kill” ? This section explains what is going on here, how the signals are generated and handled and the usefulness of this function within an OS.
Chapter 11: Process Scheduling
This is extremely important to Linux especially when it comes to performance. This section is one that is quite dated as this is a 2.4 based book and if you want to work on the 2.6 series further reading is required to get up to speed on the changes. This goes for many of the other chapters but is doubly important here.
Chapter 12: The Virtual Filesystem
Whether writing filesystem device drivers, wondering why NTFS is a nigthmare in Linux or just have a general interest in the filesystem this gives some detail on the problems and solutions Linux has in relation to filesystem drivers.
Chapter 13: Managing I/O Devices
Again this chapter seems to be getting out of place, could be that I just disagree with what comes first when understanding the OS but this could have been done before the VFS chapter. Nonetheless the content itself is excellent.
Chapter 14: Disk Caches
This is a very short chapter, which could have been integrated to become a chapter which focused on disks and combined a few of the chapters before and after this one.
Chapter 15: Accessing Files
Kernel interactions with files covered here. Again this would have had better flow if it was combined with previous chapters and would probably have made for less fragmented reading if it was all tied together.
Chapter 16: Swapping: methods for Freeing Memory
This is an area where I had most to learn from the book and this chapter did not dissapoint. I've never been able to understand the swap as well as this section describes it. It really does tie up all the previous memory knowledge. I wish I could have read it earlier in the book when memory was being introduced.
Chapter 17: The Ext2 and Ext3 Filesystems
Good guide to how the filesystems work although not everything you need to know on the subject. Perhaps I was over expectant from the high detail in previous chapters but this chapter just didn't cover all the angles. This can be excused however as the filesystem was only to be covered from the kernel side and the details of the system weren't really in scope of the text.
Chapter 18: Networking
How to make friends at Linux parties er... no sorry.... How the kernel talks to the LAN. I loved this section of the book, even though I had more knowledge on this area of Linux than any other, it made fantastic reading and without a doubt is the best resource on the subject.
Chapter 19: Process Communication
I know we did processes previously but we've bounced back so we can cover process communication, decent overview here but still chapter fragmentation bothers me.
Chapter 20: Program Execution
All about the files and the format, again not entirely scope so not complete in detail but the information required to understand the kernel is there and there is no real omission so it makes a whole lot of sense.
Style and Detail
I Cannot fault the detail in this book, it was excellent in how it covered each topic and the diagrammatic representation of key concepts is unrivalled in any book I've ever read. The only text with more detail on the Linux kernel is downloadable from kernel.org and is a collection of source code – Linux itself. Armed with a copy of the kernel and this text I don't think there is anything about Linux you would be unaware of. Truly excellent on this feature and enough to satisfy anyone, probably even Linus Torvalds. Style however I have an obvious gripe with. Since the kernel can be looked at from a multitude of angles I can see the authors problems in finding a structure for the book, however I don't think they chose the right one and some of the chapters were just to fragmented and separated to make it a truly joyful read, flipping backwards and forwards constantly in a text is not an easy way to read and stay on track. Other than that however each chapter introduced and explained itself wonderfully and there is no fault in the books content, everything is in there. An important note is that this is a 2.4 book and is nowhere near enough to understand 2.6. To get to grips with 2.6 you will have to wait for the next edition, or more sensibly look up the changes online. It's not impossible to grasp 2.6 from reading this book but the changes are significant enough to require further reading.
If you want to write kernel code, if you have an interest in Linux internals, if you have wondered why something was done a certain way or if you have questions that you really must have answered then you want to read this book. What you will need is a lot of time and a whole lot of quiet because you will be taking notes and you will be looking things up. This is not a casual read and much as the authors like to think the opposite, programming knowledge is essential to understanding the books nature. The authors don't spare the horses when it gets technical and you have to keep up or you won't remember the important information when the book gets heavier. On the whole though you won't find a better text and I'm glad I read it, I'll look back at it again and again in the future. I've given this book 9/10 and the only reason it's not a 10 is that the fragmentation really bothered me, other than that I loved it and found each and every word interesting.
This book receives an honoured SFDC Rating of 9/10.
Keywords: Linux Device Driver Kernel 2.4 Process Memory
This review is copyright 2005 by Barrie Dempster and Security-Forums Dot Com, and may not be reproduced in any form in any media without the express permission of Barrie Dempster, or Security-Forums Dot Com.