You are previewing Understanding the Linux Kernel.
O'Reilly logo
Understanding the Linux Kernel

Book Description

Why is Linux so efficient? Is it the right operating system for a particular application? What can be learned from looking at the kernel source code? These are the kinds of questions that Understanding the Linux Kernel takes in stride in this guided tour of the code that forms the core of all Linux operating systems. Linux is presented too often as a casual hacker experiment. It has increasingly become not only a mission-critical part of many organizations, but a sophisticated display of programming skill. It incorporates many advanced operating system concepts and has proven itself extremely robust and efficient for a wide range of uses. Understanding the Linux Kernel helps readers understand how Linux performs best and how it meets the challenge of different environments. The authors introduce each topic by explaining its importance, and show how kernel operations relate to the utilities that are familiar to Unix programmers and users. Major topics include:

  • Memory management, including file buffering, process swapping, and Direct Memory Access (DMA)

  • The Virtual File System and the Second Extended File System

  • Process creation and scheduling

  • Signals, interrupts, and the essential interfaces to device drivers

  • Timing

  • Synchronization in the kernel

  • Inter-Process Communication (IPC)

  • Program execution

Table of Contents

  1. Copyright
  2. Preface
    1. The Audience for This Book
    2. Organization of the Material
    3. Overview of the Book
    4. Background Information
    5. Conventions in This Book
    6. How to Contact Us
    7. Acknowledgments
  3. Introduction
    1. Linux Versus Other Unix-Like Kernels
    2. Hardware Dependency
    3. Linux Versions
    4. Basic Operating System Concepts
    5. An Overview of the Unix Filesystem
    6. An Overview of Unix Kernels
  4. Memory Addressing
    1. Memory Addresses
    2. Segmentation in Hardware
    3. Segmentation in Linux
    4. Paging in Hardware
    5. Paging in Linux
    6. Anticipating Linux 2.4
  5. Processes
    1. Process Descriptor
    2. Process Switching
    3. Creating Processes
    4. Destroying Processes
    5. Anticipating Linux 2.4
  6. Interrupts and Exceptions
    1. The Role of Interrupt Signals
    2. Interrupts and Exceptions
    3. Nested Execution of Exception and Interrupt Handlers
    4. Initializing the Interrupt Descriptor Table
    5. Exception Handling
    6. Interrupt Handling
    7. Returning from Interrupts and Exceptions
    8. Anticipating Linux 2.4
  7. Timing Measurements
    1. Hardware Clocks
    2. The Timer Interrupt Handler
    3. PIT's Interrupt Service Routine
    4. The TIMER_BH Bottom Half Functions
    5. System Calls Related to Timing Measurements
    6. Anticipating Linux 2.4
  8. Memory Management
    1. Page Frame Management
    2. Memory Area Management
    3. Noncontiguous Memory Area Management
    4. Anticipating Linux 2.4
  9. Process Address Space
    1. The Process's Address Space
    2. The Memory Descriptor
    3. Memory Regions
    4. Page Fault Exception Handler
    5. Creating and Deleting a Process Address Space
    6. Managing the Heap
    7. Anticipating Linux 2.4
  10. System Calls
    1. POSIX APIs and System Calls
    2. System Call Handler and Service Routines
    3. Wrapper Routines
    4. Anticipating Linux 2.4
  11. Signals
    1. The Role of Signals
    2. Sending a Signal
    3. Receiving a Signal
    4. Real-Time Signals
    5. System Calls Related to Signal Handling
    6. Anticipating Linux 2.4
  12. Process Scheduling
    1. Scheduling Policy
    2. The Scheduling Algorithm
    3. System Calls Related to Scheduling
    4. Anticipating Linux 2.4
  13. Kernel Synchronization
    1. Kernel Control Paths
    2. Synchronization Techniques
    3. The SMP Architecture
    4. The Linux/SMP Kernel
    5. Anticipating Linux 2.4
  14. The Virtual Filesystem
    1. The Role of the VFS
    2. VFS Data Structures
    3. Filesystem Mounting
    4. Pathname Lookup
    5. Implementations of VFS System Calls
    6. File Locking
    7. Anticipating Linux 2.4
  15. Managing I/O Devices
    1. I/O Architecture
    2. Associating Files with I/O Devices
    3. Device Drivers
    4. Character Device Handling
    5. Block Device Handling
    6. Page I/O Operations
    7. Anticipating Linux 2.4
  16. Disk Caches
    1. The Buffer Cache
    2. The Page Cache
    3. Anticipating Linux 2.4
  17. Accessing Regular Files
    1. Reading and Writing a Regular File
    2. Memory Mapping
    3. Anticipating Linux 2.4
  18. Swapping: Methods for Freeing Memory
    1. What Is Swapping?
    2. Swap Area
    3. The Swap Cache
    4. Transferring Swap Pages
    5. Page Swap-Out
    6. Page Swap-In
    7. Freeing Page Frames
    8. Anticipating Linux 2.4
  19. The Ext2 Filesystem
    1. General Characteristics
    2. Disk Data Structures
    3. Memory Data Structures
    4. Creating the Filesystem
    5. Ext2 Methods
    6. Managing Disk Space
    7. Reading and Writing an Ext2 Regular File
    8. Anticipating Linux 2.4
  20. Process Communication
    1. Pipes
    2. FIFOs
    3. System V IPC
    4. Anticipating Linux 2.4
  21. Program Execution
    1. Executable Files
    2. Executable Formats
    3. Execution Domains
    4. The exec-like Functions
    5. Anticipating Linux 2.4
  22. System Startup
    1. Prehistoric Age: The BIOS
    2. Ancient Age: The Boot Loader
    3. Middle Ages: The setup( ) Function
    4. Renaissance: The startup_32( ) Functions
    5. Modern Age: The start_kernel( ) Function
  23. Modules
    1. To Be (a Module) or Not to Be?
    2. Module Implementation
    3. Linking and Unlinking Modules
    4. Linking Modules on Demand
  24. Source Code Structure
  25. Bibliography
    1. Books on Unix Kernels
    2. Books on the Linux Kernel
    3. Books on PC Architecture and Technical Manuals on Intel 80x86
    4. Other Online Documentation Sources
  26. Colophon
  27. Index