Book description
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.
© Copyright Pearson Education. All rights reserved.
Table of contents
- Copyright
- Prentice Hall: Open Source Software Development Series
- Foreword
- Acknowledgments
- About the Authors
- Preface
-
1. Overview
- 1.1. History of UNIX
- 1.2. Standards and Common Interfaces
- 1.3. Free Software and Open Source
- 1.4. A Quick Survey of Linux Distributions
- 1.5. Kernel Release Information
- 1.6. Linux on Power
- 1.7. What Is an Operating System?
- 1.8. Kernel Organization
-
1.9. Overview of the Linux Kernel
- 1.9.1. User Interface
- 1.9.2. User Identification
- 1.9.3. Files and Filesystems
- 1.9.4. Processes
- 1.9.5. System Calls
- 1.9.6. Linux Scheduler
- 1.9.7. Linux Device Drivers
- 1.10. Portability and Architecture Dependence
- Summary
- Exercises
-
2. Exploration Toolkit
- 2.1. Common Kernel Datatypes
- 2.2. Assembly
- 2.3. Assembly Language Example
- 2.4. Inline Assembly
- 2.5. Quirky C Language Usage
- 2.6. A Quick Tour of Kernel Exploration Tools
- 2.7. Kernel Speak: Listening to Kernel Messages
- 2.8. Miscellaneous Quirks
- Summary
- Project: Hellomod
- Exercises
-
3. Processes: The Principal Model of Execution
- 3.1. Introducing Our Program
- 3.2. Process Descriptor
- 3.3. Process Creation: fork(), vfork(), and clone() System Calls
- 3.4. Process Lifespan
- 3.5. Process Termination
- 3.6. Keeping Track of Processes: Basic Scheduler Construction
- 3.7. Wait Queues
-
3.8. Asynchronous Execution Flow
- 3.8.1. Exceptions
-
3.8.2. Interrupts
- 3.8.2.1. Interrupt Handlers
- 3.8.2.2. IRQ Structures
-
3.8.2.3. An Interrupt Example: System Timer
- Line 413
- Line 902
- Lines 908–910
- Lines 912–935
- Lines 941–942
- Line 947
- Line 949
- Line 415
- Line 410
- Lines 342–348
- Lines 422–426
- Line 431
- Line 437
- Line 419
- Line 317
- Line 351
- Line 72
- Lines 81–84
- Interrupt Time
- Processing the PowerPC External Interrupt Vector
- Lines 513–530
- Line 523
- Line 524
- Line 432
- Line 435
- Line 436
- Lines 441–443
- Line 450
- Lines 451–462
- Lines 463–465
- Lines 489–497
- Processing the PowerPC System Timer Interrupt
- Line 152
- Line 159
- Lines 165 and 195
- Line 167
- Line 189
- Line 198
- Line 208
- Processing the x86 System Timer Interrupt
- Line 274
- Line 287
- Line 227
- Line 18
- Line 25
- Summary
- Project: current System Variable
- Exercises
-
4. Memory Management
- 4.1. Pages
- 4.2. Memory Zones
- 4.3. Page Frames
- 4.4. Slab Allocator
- 4.5. Slab Allocator's Lifecycle
- 4.6. Memory Request Path
-
4.7. Linux Process Memory Structures
-
4.7.1. mm_struct
- 4.7.1.1. mmap
- 4.7.1.2. mm_rb
- 4.7.1.3. mmap_cache
- 4.7.1.4. pgd
- 4.7.1.5. mm_users
- 4.7.1.6. mm_count
- 4.7.1.7. map_count
- 4.7.1.8. mm_list
- 4.7.1.9. start_code and end_code
- 4.7.1.10. start_data and end_data
- 4.7.1.11. start_brk and brk
- 4.7.1.12. start_stack
- 4.7.1.13. arg_start and arg_end
- 4.7.1.14. env_start and env_end
- 4.7.2. vm_area_struct
-
4.7.1. mm_struct
- 4.8. Process Image Layout and Linear Address Space
- 4.9. Page Tables
- 4.10. Page Fault
- Summary
- Project: Process Memory Map
- Exercises
-
5. Input/Output
- 5.1. How Hardware Does It: Busses, Bridges, Ports, and Interfaces
-
5.2. Devices
- 5.2.1. Block Device Overview
- 5.2.2. Request Queues and Scheduling I/O
- 5.2.3. Example: “Generic” Block Driver
- 5.2.4. Device Operations
- 5.2.5. Character Device Overview
- 5.2.6. A Note on Network Devices
- 5.2.7. Clock Devices
- 5.2.8. Terminal Devices
- 5.2.9. Direct Memory Access (DMA)
- Summary
- Project: Building a Parallel Port Driver
- Exercises
-
6. Filesystems
- 6.1. General Filesystem Concepts
- 6.2. Linux Virtual Filesystem
- 6.3. Structures Associated with VFS
- 6.4. Page Cache
-
6.5. VFS System Calls and the Filesystem Layer
- 6.5.1. open ()
- 6.5.2. close ()
-
6.5.3. read()
- Line 272
- Lines 273–282
- Line 200
- Line 202
- Lines 205–208
- Lines 210–214
- Lines 215–217
- 6.5.3.1. Moving from the Generic to the Specific
-
6.5.3.2. Tracing the Page Cache
- Lines 1420–1430
- Line 652
- Lines 658–660
- Lines 662–681
- Lines 682–689
- Lines 690–723
- Lines 724–740
- Lines 741–743
- Lines 746–750
- Lines 751–758
- Lines 698–772
- Lines 773–775
- Lines 776–777
- Lines 779–781
- Line 786
- Lines 787–788
- Line 789
- Lines 360–361
- Lines 363–364
- Lines 365–367
- Line 90
- Lines 92–94
- Lines 95–96
- Lines 2433–2443
- Lines 2445–2452
- Line 2454
- 6.5.4. write()
- Summary
- Exercises
-
7. Scheduling and Kernel Synchronization
-
7.1. Linux Scheduler
- 7.1.1. Choosing the Next Task
- 7.1.2. Context Switch
- 7.1.3. Yielding the CPU
- 7.2. Preemption
- 7.3. Spinlocks and Semaphores
- 7.4. System Clock: Of Time and Timers
- Summary
- Exercises
-
7.1. Linux Scheduler
-
8. Booting the Kernel
- 8.1. BIOS and Open Firmware
- 8.2. Boot Loaders
- 8.3. Architecture-Dependent Memory Initialization
- 8.4. Initial RAM Disk
-
8.5. The Beginning: start_kernel()
- 8.5.1. The Call to lock_kernel()
- 8.5.2. The Call to page_address_init()
- 8.5.3. The Call to printk(linux_banner)
- 8.5.4. The Call to setup_arch
- 8.5.5. The Call to setup_per_cpu_areas()
- 8.5.6. The Call to smp_prepare_boot_cpu()
- 8.5.7. The Call to sched_init()
- 8.5.8. The Call to build_all_zonelists()
- 8.5.9. The Call to page_alloc_init
- 8.5.10. The Call to parse_args()
- 8.5.11. The Call to trap_init()
- 8.5.12. The Call to rcu_init()
- 8.5.13. The Call to init_IRQ()
- 8.5.14. The Call to softirq_init()
- 8.5.15. The Call to time_init()
- 8.5.16. The Call to console_init()
- 8.5.17. The Call to profile_init()
- 8.5.18. The Call to local_irq_enable()
- 8.5.19. initrd Configuration
- 8.5.20. The Call to mem_init()
- 8.5.21. The Call to late_time_init()
- 8.5.22. The Call to calibrate_delay()
- 8.5.23. The Call to pgtable_cache_init()
- 8.5.24. The Call to buffer_init()
- 8.5.25. The Call to security_scaffolding_startup()
- 8.5.26. The Call to vfs_caches_init()
- 8.5.27. The Call to radix_tree_init()
- 8.5.28. The Call to signals_init()
- 8.5.29. The Call to page_writeback_init()
- 8.5.30. The Call to proc_root_init()
- 8.5.31. The Call to init_idle()
- 8.5.32. The Call to rest_init()
- 8.6. The init Thread (or Process 1)
- Summary
- Exercises
- 9. Building the Linux Kernel
-
10. Adding Your Code to the Kernel
- 10.1. Traversing the Source
- 10.2. Writing the Code
- 10.3. Building and Debugging
- Summary
- Exercises
- Bibliography
Product information
- Title: Linux® Kernel Primer, The: A Top-Down Approach for x86 and PowerPC Architectures
- Author(s):
- Release date: September 2005
- Publisher(s): Pearson
- ISBN: 0131181637
You might also like
book
Mobile 3D Graphics SoC: From Algorithm to Chip
The first book to explain the principals behind mobile 3D hardware implementation, helping readers understand advanced …
article
Run Llama-2 Models Locally with llama.cpp
Llama is Meta’s answer to the growing demand for LLMs. Unlike its well-known technological relative, ChatGPT, …
article
Use Github Copilot for Prompt Engineering
Using GitHub Copilot can feel like magic. The tool automatically fills out entire blocks of code--but …
book
Debugging Linux Systems
Debugging Linux Systems discusses the main tools available today to debug 2.6 Linux Kernels. We start …