• Table of Contents • Index by Robert Love Publisher: Sams Publishing
Total Page:16
File Type:pdf, Size:1020Kb
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks. Linux Kernel Development Second Edition By Robert Love Publisher: Sams Publishing Pub Date: January 12, 2005 ISBN: 0-672-32720-1 • Table of Contents Pages: 432 • Index The Linux kernel is one of the most interesting yet least understood open-source projects. It is also a basis for developing new kernel code. That is why Sams is excited to bring you the latest Linux kernel development information from a Novell insider in the second edition of Linux Kernel Development. This authoritative, practical guide will help you better understand the Linux kernel through updated coverage of all the major subsystems, new features associated with Linux 2.6 kernel and insider information on not-yet-released developments. You'll be able to take an in-depth look at Linux kernel from both a theoretical and an applied perspective as you cover a wide range of topics, including algorithms, system call interface, paging strategies and kernel synchronization. Get the top information right from the source in Linux Kernel Development. This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks. Linux Kernel Development Second Edition By Robert Love Publisher: Sams Publishing Pub Date: January 12, 2005 ISBN: 0-672-32720-1 • Table of Contents Pages: 432 • Index Copyright Foreword Preface So Here We Are Kernel Version Audience Book Website Second Edition Acknowledgments About the Author We Want to Hear from You! Reader Services Chapter 1. Introduction to the Linux Kernel Along Came Linus: Introduction to Linux Overview of Operating Systems and Kernels Linux Versus Classic Unix Kernels Linux Kernel Versions The Linux Kernel Development Community Before We Begin Chapter 2. Getting Started with the Kernel Obtaining the Kernel Source The Kernel Source Tree Building the Kernel A Beast of a Different Nature So Here We Are Chapter 3. Process Management Process Descriptor and the Task Structure Process Creation The Linux Implementation of Threads Process Termination Process Wrap Up Chapter 4. Process Scheduling Policy The Linux Scheduling Algorithm Preemption and Context Switching Real-Time Scheduler-Related System Calls Scheduler Finale This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks. Chapter 5. System Calls APIs, POSIX, and the C Library Syscalls System Call Handler System Call Implementation System Call Context System Calls in Conclusion Chapter 6. Interrupts and Interrupt Handlers Interrupts Interrupt Handlers Registering an Interrupt Handler Writing an Interrupt Handler Interrupt Context Implementation of Interrupt Handling Interrupt Control Don't Interrupt Me; We're Almost Done! Chapter 7. Bottom Halves and Deferring Work Bottom Halves Softirqs Tasklets Work Queues Which Bottom Half Should I Use? Locking Between the Bottom Halves The Bottom of Bottom-Half Processing Endnotes Chapter 8. Kernel Synchronization Introduction Critical Regions and Race Conditions Locking Deadlocks Contention and Scalability Locking and Your Code Chapter 9. Kernel Synchronization Methods Atomic Operations Spin Locks Reader-Writer Spin Locks Semaphores Reader-Writer Semaphores Spin Locks Versus Semaphores Completion Variables BKL: The Big Kernel Lock Preemption Disabling Ordering and Barriers Synchronization Summarization Chapter 10. Timers and Time Management Kernel Notion of Time The Tick Rate: HZ Jiffies Hardware Clocks and Timers The Timer Interrupt Handler The Time of Day This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks. Timers Delaying Execution Out of Time Chapter 11. Memory Management Pages Zones Getting Pages kmalloc() vmalloc() Slab Layer Slab Allocator Interface Statically Allocating on the Stack High Memory Mappings Per-CPU Allocations The New percpu Interface Reasons for Using Per-CPU Data Which Allocation Method Should I Use? Chapter 12. The Virtual Filesystem Common Filesystem Interface Filesystem Abstraction Layer Unix Filesystems VFS Objects and Their Data Structures The Superblock Object The Inode Object The Dentry Object The File Object Data Structures Associated with Filesystems Data Structures Associated with a Process Filesystems in Linux Chapter 13. The Block I/O Layer Anatomy of a Block Device Buffers and Buffer Heads The bio structure Request Queues I/O Schedulers Summary Chapter 14. The Process Address Space The Memory Descriptor Memory Areas Manipulating Memory Areas mmap() and do_mmap(): Creating an Address Interval munmap() and do_munmap(): Removing an Address Interval Page Tables Conclusion Chapter 15. The Page Cache and Page Writeback Page Cache Radix Tree The Buffer Cache The pdflush Daemon To Make a Long Story Short This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks. Chapter 16. Modules Hello, World! Building Modules Installing Modules Generating Module Dependencies Loading Modules Managing Configuration Options Module Parameters Exported Symbols Wrapping Up Modules Chapter 17. kobjects and sysfs kobjects ktypes ksets Subsystems Structure Confusion Managing and Manipulating kobjects Reference Counts sysfs The Kernel Events Layer kobjects and sysfs in a Nutshell Chapter 18. Debugging What You Need to Start Bugs in the Kernel printk() Oops Kernel Debugging Options Asserting Bugs and Dumping Information Magic SysRq Key The Saga of a Kernel Debugger Poking and Probing the System Binary Searching to Find the Culprit Change When All Else Fails: The Community Chapter 19. Portability History of Portability in Linux Word Size and Data Types Data Alignment Byte Order Time Page Size Processor Ordering SMP, Kernel Preemption, and High Memory Endnotes Chapter 20. Patches, Hacking, and the Community The Community Linux Coding Style Chain of Command Submitting Bug Reports Generating Patches Submitting Patches This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks. Conclusion Appendix A. Linked Lists Circular Linked Lists The Linux Kernel's Implementation Manipulating Linked Lists Traversing Linked Lists Appendix B. Kernel Random Number Generator Design and Implementation Interfaces to Input Entropy Interfaces to Output Entropy Appendix C. Algorithmic Complexity Algorithms Big-O Notation Big Theta Notation Putting It All Together Perils of Time Complexity Bibliography and Reading List Books on Operating System Design Books on Unix Kernels Books on Linux Kernels Books on Other Kernels Books on the Unix API Books on the C Programming Language Other Works Websites Index This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register. it. Thanks Copyright Copyright © 2005 by Pearson Education, Inc. All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein. Library of Congress Catalog Card Number: 2004095004 Printed in the United States of America First Printing: January 2005 08 07 06 05 4 3 2 1 Trademarks All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Novell Press cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. Warning and Disclaimer Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an "as is" basis. The author and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book. Special and Bulk Sales Pearson offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales. For more information, please contact U.S. Corporate and Government Sales 1-800-382-3419 [email protected] For sales outside of the U.S., please contact International Sales [email protected] Credits This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks . Senior Editor Scott D. Meyers Managing Editor Charlotte Clapp Project Editor George Nedeff Copy Editor Margo Catts Indexer Chris Barrick Proofreader Tracy Donhardt Technical Editors Adam Belay Martin Pool Chris Rivera Publishing Coordinator Vanessa Evans Book Designer Gary Adair Page Layout Michelle Mitchell Dedication To Doris and Helen. This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks. Foreword As the Linux kernel and the applications that use it become more widely used, we are seeing an increasing number of system software developers who wish to become involved in the development and maintenance of Linux. Some of these engineers are motivated purely by personal interest, some work for Linux companies,