The Linux Kernel Primer: A Top-Down Approach for x86 and PowerPC Architectures

Paperback (Print)
Used and New from Other Sellers
Used and New from Other Sellers
from $8.63
Usually ships in 1-2 business days
(Save 84%)
Other sellers (Paperback)
  • All (13) from $8.63   
  • New (5) from $42.99   
  • Used (8) from $8.63   


Learn Linux kernel programming, hands-on: a uniquely effective top-down approach

The Linux® Kernel Primer is the definitive guide to Linux kernel programming. The authors' unique top-down approach makes kernel programming easier to understand by systematically tracing functionality from user space into the kernel and carefully associating kernel internals with user-level programming fundamentals. Their approach helps you build on what you already know about Linux, gaining a deep understanding of how the kernel works and how its elements fit together.

One step at a time, the authors introduce all the tools and assembly language programming techniques required to understand kernel code and control its behavior. They compare x86 and PowerPC implementations side-by-side, illuminating cryptic functionality through carefully-annotated source code examples and realistic projects. The Linux® Kernel Primer is the first book to offer in-depth coverage of the rapidly growing PowerPC Linux development platform, and the only book to thoroughly discuss kernel configuration with the Linux build system. Coverage includes

  • Data structures
  • x86 and PPC assembly language
  • Viewing kernel internals
  • Linux process model
  • User and kernel space
  • Interrupts and exceptions
  • Memory allocation and tracking
  • Tracing subsystem behavior
  • I/O interactions
  • Filesystems and file operations
  • Scheduling and synchronization
  • Kernel boot process
  • Kernel build system
  • Configuration options
  • Device drivers
  • And more...

If you know C, this book teaches you all the skills and techniques you need to succeed with Linux kernel programming. Whether you're a systems programmer, software engineer, systems analyst, test professional, open source project contributor, or simply a Linux enthusiast, you'll find it indispensable.

Read More Show Less

Editorial Reviews

From the Publisher


Full Text:

I've been less than happy with other kernel books I've read. Admittedly,it's a difficult subject: there's a lot to cover, and you really need quite a bit of programming and general Unix knowledge before you could even consider jumping into this area. But I have the background,have even written simple Unix drivers, and yet every other kernel programming book has disappointed me.

It's all so overwhelming: there are conventions and quirks that have developed over time and surely are second nature to the people who have been doing Linux kernels for years, but these things are baffling to the newcomer.

This book tries to get you past that. The authors specifically say that they have tried to cover the things that confused them when they first started looking at the kernel. I'm sure their efforts aren't perfect, but the effort does definitely show.

The authors present several programming projects to help explore the kernel concepts, and every chapter has review questions to help firm up your understanding. The approach is from user space when possible: the assumption is that you are comfortable with application programming and that is used as the base to lead you down into the work done by the kernel for your programs. There's plenty of annotated source code here, both for x86 and PowerPC architectures. The inclusion of PowerPC information was an unexpected bonus; other books I've read have usually ignored that entirely or glossed it over quickly.

Of course you need a background in C, and while this does try to cover general kernel subjects, it wouldn't hurt to have at least some prior reading there. A little familiarity with hardware and light assembly language will help also, although the authors do give some coverage there.

I'm looking forward to spending more time exploring this book.

Read More Show Less

Product Details

Meet the Author

Claudia Salzberg Rodriguez has been a Linux systems programmer for over 5 years and has worked with Linux on a wide variety of platforms ranging from embedded to High Performance systems on both Intel and PPC. She received a Bachelor of Science from Brown University in 1997 and a Master of Science in Computer Science from the University of Pennsylvania in 1999. She currently works in IBM's Linux Technology Center developing the kernel and associated programming tools.

Gordon Fischer has been using Linux and other Unices since 1996. He has written device drivers for RF tuners, modulators and other low-level devices. He has used both the 2.2 and 2.4 Linux kernels in enterprise settings ranging from servers to embedded devices across both i386 and PPC chipsets. He believes all code should be written in either C or LISP.

Steve Smolski has been in the semiconductor business for 26 years and has always been interested in the line between hardware and software. He has worked in manufacturing, test, and development of memory, processors, and ASICS. He has written applications and device drivers for Windows, AIX, Linux, and several embedded operating systems. His favorite jobs have been in robotics and multimedia.

© Copyright Pearson Education. All rights reserved.

Read More Show Less

Table of Contents


About the Authors.



1. Overview.

2. Exploration Toolkit.

3. Processes: The Principal Model of Execution.

4. Memory Management.

5. Input/Output.

6. Filesystems.

7. Scheduling and Kernel Synchronization.

8. Booting the Kernel.

9. Building the Linux Kernel.

10. Adding Your Code to the Kernel.



Read More Show Less


Technology in general and computers in specific have a magical allure that seems to consume those who would approach them. Developments in technology push established boundaries and force the re-evaluation of troublesome concepts previously laid to rest. The Linux operating system has been a large contributor to a torrent of notable shifts in industry and the way business is done. By its adoption of the GNU Public License and its interactions with GNU software, it has served as a cornerstone to the various debates that surround open source, free software, and the concept of the development community. Linux is an extremely successful example of how powerful an open source operating system can be, and how the magic of its underpinnings can hold programmers from all corners of the world spellbound.

The use of Linux is something that is increasingly accessible to most computer users. With multiple distributions, community support, and industry backing, the use of Linux has also found safe harbor in universities, industrial applications, and the homes of millions of users.

Increased need in support and for new functionality follow at the heels of this upsurge in use. In turn, more and more programmers are finding themselves interested in the internals of the Linux kernel as the number of architectures and devices that demand support are added to the already vast (and rapidly growing) arsenal.

The porting of the Linux kernel to the Power architecture has contributed to the operating system's blossoming among high-end servers and embedded systems. The need for understanding how Linux runs on the Power architecture has grown, with companies now purchasing PowerPC-based systems intended to run Linux.

Intended Audience

This book is intended for the budding and veteran systems programmer, the Linux enthusiast, and the application programmer eager to have a better understanding of what makes his programs work the way they do. Anyone who has knowledge of C, familiarity with basic Linux user fundamentals, and wants to know how Linux works should find this book provides him with the basic concepts necessary to build this understanding—it is intended to be a primer for understanding how the Linux kernel works.

Whether your experience with Linux has been logging in and writing small programs to run on Linux, or you are an established systems programmer seeking to understand particularities of one of the subsystems, this book provides you with the information you are looking for.

Organization of Material

This book is divided into three parts, each of which provides the reader with knowledge necessary to succeed in the study of Linux internals.

Part I provides the necessary tools and understanding to tackle the exploration of the kernel internals:

Chapter 1, "Overview," provides a history of Linux and UNIX, a listing of the many distributions, and a short overview of the various kernel subsystems from a user space perspective.

Chapter 2, "Exploration Toolkit," provides a description of the data structures and language usage commonly found throughout the Linux kernel, an introduction to assembly for x86 and PowerPC architectures, and a summary of tools and utilities used to get the information needed to understand kernel internals.

Part II introduces the reader to the basic concepts in each kernel subsystem and to trace the code that executes the subsystem functionality:

Chapter 3, "Processes: The Principal Model of Execution," covers the implementation of the process model. We explain how processes come to be and discuss the flow of control of a user space process into kernel space and back. We also discuss how processes are implemented in the kernel and discuss all data structures associated with process execution. This chapter also covers interrupts and exceptions, how these hardware mechanisms occur in each of the architectures, and how they interact with the Linux kernel.

Chapter 4, "Memory Management," describes how the Linux kernel tracks and manages available memory among various user space processes and the kernel. This chapter describes the way in which the kernel categorizes memory and how it decides to allocate and deallocate memory. It also describes in detail the mechanism of the page fault and how it is executed in the hardware.

Chapter 5, "Input/Output," describes how the processor interacts with other devices, and how the kernel interfaces and controls these interactions. This chapter also covers various kinds of devices and their implementation in the kernel.

Chapter 6, "Filesystems," provides an overview of how files and directories are implemented in the kernel. This chapter introduces the virtual filesystem, the layer of abstraction used to support multiple filesystems. This chapter also traces the execution of file-related operations such as open and close.

Chapter 7, "Scheduling and Kernel Synchronization," describes the operation of the scheduler, which allows multiple processes to run as though they are the only process in the system. This chapter covers in detail how the kernel selects which task to execute and how it interfaces with the hardware to switch from one process to another. This chapter also describes what kernel preemption is and how it is executed. Finally, it describes how the system clock works and its use by the kernel to keep time.

Chapter 8, "Booting the Kernel," describes what happens from Power On to Power Off. It traces how the various processors handle the loading of the kernel, including a description of BIOS, Open Firmware, and bootloaders. This chapter then goes through the linear order in kernel bringup and initialization, covering all the subsystems discussed in previous chapters.

Part III deals with a more hands-on approach to building and interacting with the Linux kernel:

Chapter 9, "Building the Linux Kernel," covers the toolchain necessary to build the kernel and the format of the object files executed. It also describes in detail how the Kernel Source Build system operates and how to add configuration options into the kernel build system.

Chapter 10, "Adding Your Code to the Kernel," describes the operation of /dev/random, which is seen in all Linux systems. As it traces the device, the chapter touches on previously described concepts from a more practical perspective. It then covers how to implement your own device in the kernel.

Our Approach

This book introduces the reader to the concepts necessary to understand the kernel. We follow a top-down approach in the following two ways:

First, we associate the kernel workings with the execution of user space operations the reader may be more familiar with and strive to explain the kernel workings in association with this. When possible, we begin with a user space example and trace the execution of the code down into the kernel. It is not always possible to follow this tracing straight down since the subsystem data types and substructures need to be introduced before the explanation of how it works can take place. In these cases, we tie in explanations of the kernel subsystem with specific examples of how it relates to a user space program. The intent is twofold: to highlight the layering seen in the kernel as it interfaces with user space on one side and the hardware on the other, and to explain workings of the subsystem by tracing the code and following the order of events as they occur. We believe this will help the reader get a sense of how the kernel workings fit in with what he knows, and will provide him with a framed reference for how a particular functionality associates to the rest of the operating system.

Second, we use the top-down perspective to view the data structures central to the operation of the subsystem and see how they relate to the execution of the system's management. We strive to delineate structures central to the subsystem operation and to keep focus on them as we follow the operation of the subsystem.


Throughout this book, you will see listings of the source code. The top-right corner will hold the location of the source file with respect to the root of the source code tree. The listings are shown in this font. Line numbers are provided for the code commentary that usually follows. As we explain the kernel subsystem and how it works, we will continually refer to the source code and explain it.

Command-line options, function names, function output, and variable names are distinguished by this font.

Bold type is used whenever a new concept is introduced.

© Copyright Pearson Education. All rights reserved.

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted October 10, 2005

    advanced discussion

    In any operating system, kernel programming is reserved for a few experts in the field. Largely due to the very specialised nature of what they want to do. Linux is no exception. This book stands far afield from a typical linux sysadmin text. The authors choose to explain for two chip sets. Namely for the Intel x86. Natural and obvious, given Intel's domination of the microprocessor market. As for a second choice, there are many contenders, like the Alpha or the ARM chips. But instead, the book describes the PowerPC, which is prominently backed by IBM and Motorola. I suspect this choice might have been influenced by one of the authors being at IBM. Arguably, a credible alternative is the chip set from AMD. But the main thrust of the book is to offer a top down view of linux, drilling as close to the hardware as possible. The code excerpts are in C. (Very little kernel development seems to be done in other languages, and this book is no exception.) At the lowest level, you are shown how to access the drivers in /dev/, which in turn access the hardware. For example, one code fragment explains the reading of the real time clock on the x86. For some developers who might be used to dealing in pure software, these hardware interaction examples may be the most valuable portions of the text. Another merit of the book is presence of 2 architectures that are described. If you are developing for another chip set, the text may still be quite useful. You get 2 case studies here of how linux works. Contrasting these might give insight into what changes you need for your chip set. Overall, this is definitely an advanced book. Having a strong background in C coding is a plus.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)