Book description
In order to thoroughly understand what makes Linux tick and why it works so well on a wide variety of systems, you need to delve deep into the heart of the kernel. The kernel handles all interactions between the CPU and the external world, and determines which programs will share processor time, in what order. It manages limited memory so well that hundreds of processes can share the system efficiently, and expertly organizes data transfers so that the CPU isn't kept waiting any longer than necessary for the relatively slow disks.
The third edition of Understanding the Linux Kernel takes you on a guided tour of the most significant data structures, algorithms, and programming tricks used in the kernel. Probing beyond superficial features, the authors offer valuable insights to people who want to know how things really work inside their machine. Important Intel-specific features are discussed. Relevant segments of code are dissected line by line. But the book covers more than just the functioning of the code; it explains the theoretical underpinnings of why Linux does things the way it does.
This edition of the book covers Version 2.6, which has seen significant changes to nearly every kernel subsystem, particularly in the areas of memory management and block devices. The book focuses on the following topics:
- Memory management, including file buffering, process swapping, and Direct memory Access (DMA)
- The Virtual Filesystem layer and the Second and Third Extended Filesystems
- Process creation and scheduling
- Signals, interrupts, and the essential interfaces to device drivers
- Timing
- Synchronization within the kernel
- Interprocess Communication (IPC)
- Program execution
Understanding the Linux Kernel will acquaint you with all the inner workings of Linux, but it's more than 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. This book will help you make the most of your Linux system.
Publisher resources
Table of contents
- Understanding the Linux Kernel, 3rd Edition
- Preface
-
1. Introduction
- 1.1. Linux Versus Other Unix-Like Kernels
- 1.2. Hardware Dependency
- 1.3. Linux Versions
- 1.4. Basic Operating System Concepts
- 1.5. An Overview of the Unix Filesystem
- 1.6. An Overview of Unix Kernels
-
2. Memory Addressing
- 2.1. Memory Addresses
- 2.2. Segmentation in Hardware
- 2.3. Segmentation in Linux
- 2.4. Paging in Hardware
- 2.5. Paging in Linux
-
3. Processes
- 3.1. Processes, Lightweight Processes, and Threads
- 3.2. Process Descriptor
- 3.3. Process Switch
- 3.4. Creating Processes
- 3.5. Destroying Processes
-
4. Interrupts and Exceptions
- 4.1. The Role of Interrupt Signals
- 4.2. Interrupts and Exceptions
- 4.3. Nested Execution of Exception and Interrupt Handlers
- 4.4. Initializing the Interrupt Descriptor Table
- 4.5. Exception Handling
-
4.6. Interrupt Handling
-
4.6.1. I/O Interrupt Handling
- 4.6.1.1. Interrupt vectors
- 4.6.1.2. IRQ data structures
- 4.6.1.3. IRQ distribution in multiprocessor systems
- 4.6.1.4. Multiple Kernel Mode stacks
- 4.6.1.5. Saving the registers for the interrupt handler
- 4.6.1.6. The do_IRQ( ) function
- 4.6.1.7. The _ _do_IRQ( ) function
- 4.6.1.8. Reviving a lost interrupt
- 4.6.1.9. Interrupt service routines
- 4.6.1.10. Dynamic allocation of IRQ lines
- 4.6.2. Interprocessor Interrupt Handling
-
4.6.1. I/O Interrupt Handling
- 4.7. Softirqs and Tasklets
- 4.8. Work Queues
- 4.9. Returning from Interrupts and Exceptions
-
5. Kernel Synchronization
- 5.1. How the Kernel Services Requests
-
5.2. Synchronization Primitives
- 5.2.1. Per-CPU Variables
- 5.2.2. Atomic Operations
- 5.2.3. Optimization and Memory Barriers
- 5.2.4. Spin Locks
- 5.2.5. Read/Write Spin Locks
- 5.2.6. Seqlocks
- 5.2.7. Read-Copy Update (RCU)
- 5.2.8. Semaphores
- 5.2.9. Read/Write Semaphores
- 5.2.10. Completions
- 5.2.11. Local Interrupt Disabling
- 5.2.12. Disabling and Enabling Deferrable Functions
-
5.3. Synchronizing Accesses to Kernel Data Structures
-
5.3.1. Choosing Among Spin Locks, Semaphores, and Interrupt Disabling
- 5.3.1.1. Protecting a data structure accessed by exceptions
- 5.3.1.2. Protecting a data structure accessed by interrupts
- 5.3.1.3. Protecting a data structure accessed by deferrable functions
- 5.3.1.4. Protecting a data structure accessed by exceptions and interrupts
- 5.3.1.5. Protecting a data structure accessed by exceptions and deferrable functions
- 5.3.1.6. Protecting a data structure accessed by interrupts and deferrable functions
- 5.3.1.7. Protecting a data structure accessed by exceptions, interrupts, and deferrable functions
-
5.3.1. Choosing Among Spin Locks, Semaphores, and Interrupt Disabling
- 5.4. Examples of Race Condition Prevention
-
6. Timing Measurements
- 6.1. Clock and Timer Circuits
- 6.2. The Linux Timekeeping Architecture
- 6.3. Updating the Time and Date
- 6.4. Updating System Statistics
- 6.5. Software Timers and Delay Functions
- 6.6. System Calls Related to Timing Measurements
-
7. Process Scheduling
- 7.1. Scheduling Policy
- 7.2. The Scheduling Algorithm
- 7.3. Data Structures Used by the Scheduler
- 7.4. Functions Used by the Scheduler
- 7.5. Runqueue Balancing in Multiprocessor Systems
-
7.6. System Calls Related to Scheduling
- 7.6.1. The nice( ) System Call
- 7.6.2. The getpriority( ) and setpriority( ) System Calls
- 7.6.3. The sched_getaffinity( ) and sched_setaffinity( ) System Calls
-
7.6.4. System Calls Related to Real-Time Processes
- 7.6.4.1. The sched_getscheduler( ) and sched_setscheduler( ) system calls
- 7.6.4.2. The sched_ getparam( ) and sched_setparam( ) system calls
- 7.6.4.3. The sched_ yield( ) system call
- 7.6.4.4. The sched_ get_priority_min( ) and sched_ get_priority_max( ) system calls
- 7.6.4.5. The sched_rr_ get_interval( ) system call
-
8. Memory Management
-
8.1. Page Frame Management
- 8.1.1. Page Descriptors
- 8.1.2. Non-Uniform Memory Access (NUMA)
- 8.1.3. Memory Zones
- 8.1.4. The Pool of Reserved Page Frames
- 8.1.5. The Zoned Page Frame Allocator
- 8.1.6. Kernel Mappings of High-Memory Page Frames
- 8.1.7. The Buddy System Algorithm
- 8.1.8. The Per-CPU Page Frame Cache
- 8.1.9. The Zone Allocator
-
8.2. Memory Area Management
- 8.2.1. The Slab Allocator
- 8.2.2. Cache Descriptor
- 8.2.3. Slab Descriptor
- 8.2.4. General and Specific Caches
- 8.2.5. Interfacing the Slab Allocator with the Zoned Page Frame Allocator
- 8.2.6. Allocating a Slab to a Cache
- 8.2.7. Releasing a Slab from a Cache
- 8.2.8. Object Descriptor
- 8.2.9. Aligning Objects in Memory
- 8.2.10. Slab Coloring
- 8.2.11. Local Caches of Free Slab Objects
- 8.2.12. Allocating a Slab Object
- 8.2.13. Freeing a Slab Object
- 8.2.14. General Purpose Objects
- 8.2.15. Memory Pools
- 8.3. Noncontiguous Memory Area Management
-
8.1. Page Frame Management
-
9. Process Address Space
- 9.1. The Process’s Address Space
- 9.2. The Memory Descriptor
- 9.3. Memory Regions
- 9.4. Page Fault Exception Handler
- 9.5. Creating and Deleting a Process Address Space
- 9.6. Managing the Heap
- 10. System Calls
-
11. Signals
- 11.1. The Role of Signals
- 11.2. Generating a Signal
- 11.3. Delivering a Signal
- 11.4. System Calls Related to Signal Handling
-
12. The Virtual Filesystem
- 12.1. The Role of the Virtual Filesystem (VFS)
- 12.2. VFS Data Structures
- 12.3. Filesystem Types
- 12.4. Filesystem Handling
- 12.5. Pathname Lookup
- 12.6. Implementations of VFS System Calls
- 12.7. File Locking
-
13. I/O Architecture and Device Drivers
- 13.1. I/O Architecture
- 13.2. The Device Driver Model
- 13.3. Device Files
- 13.4. Device Drivers
- 13.5. Character Device Drivers
-
14. Block Device Drivers
- 14.1. Block Devices Handling
- 14.2. The Generic Block Layer
- 14.3. The I/O Scheduler
-
14.4. Block Device Drivers
- 14.4.1. Block Devices
-
14.4.2. Device Driver Registration and Initialization
- 14.4.2.1. Defining a custom driver descriptor
- 14.4.2.2. Initializing the custom descriptor
- 14.4.2.3. Initializing the gendisk descriptor
- 14.4.2.4. Initializing the table of block device methods
- 14.4.2.5. Allocating and initializing a request queue
- 14.4.2.6. Setting up the interrupt handler
- 14.4.2.7. Registering the disk
- 14.4.3. The Strategy Routine
- 14.4.4. The Interrupt Handler
- 14.5. Opening a Block Device File
-
15. The Page Cache
- 15.1. The Page Cache
- 15.2. Storing Blocks in the Page Cache
- 15.3. Writing Dirty Pages to Disk
- 15.4. The sync( ), fsync( ), and fdatasync( ) System Calls
- 16. Accessing Files
-
17. Page Frame Reclaiming
- 17.1. The Page Frame Reclaiming Algorithm
- 17.2. Reverse Mapping
- 17.3. Implementing the PFRA
- 17.4. Swapping
- 18. The Ext2 and Ext3 Filesystems
- 19. Process Communication
- 20. Program ExZecution
- A. System Startup
- B. Modules
- C. Bibliography
- About the Authors
- Colophon
- Copyright
Product information
- Title: Understanding the Linux Kernel, 3rd Edition
- Author(s):
- Release date: November 2005
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9780596005658
You might also like
book
Understanding the Linux Kernel, Second Edition
To thoroughly understand what makes Linux tick and why it's so efficient, you need to delve …
book
Understanding the Linux Kernel
Why is Linux so efficient? Is it the right operating system for a particular application? What …
book
The Linux Command Line, 2nd Edition
The Linux Command Line takes you from your very first terminal keystrokes to writing full programs …
video
Linux Fundamentals, 2nd Edition
10+ Hours of Video Instruction More than 10 hours of video instruction to get you up …