Sebastopol, CA--Anyone who has ever tried to plug a peripheral into a Linux box knows the importance of device drivers. This is an exciting, but largely undocumented, area of Linux development necessary for anyone who wants to support computer peripherals under the Linux operating system or develop new hardware and run it under Linux.
"Writing device drivers is both easier and harder these days," says Jonathan Corbet coauthor of the new, second edition of Linux Device Drivers (O'Reilly, US $39.95). "It is easier in that a lot of the basic kernel subsystems have been redesigned to work in a more simple and safe way. The interfaces for access to system buses and setting up DMA operations, for example, are much cleaner and easier to use. The quality of the debugging tools is improving as well. But the need to deal with concurrency and locking adds a distinct challenge. Avoiding race conditions and other concurrency-related bugs is tremendously difficult, and tracking down this type of bug is no fun. Fine-grained locking brings a great deal of complexity, but without it, scaling the kernel to large systems is difficult if not impossible."
Linux Device Drivers reveals information that previously has been shared only by word of mouth or in cryptic source code comments, on how to write drivers for a wide range of devices.
Version 2.4 of the Linux kernel includes significant changes to device drivers, simplifying many activities, but providing subtle new features that can make a driver both more efficient and more flexible. The second edition of this classic book thoroughly covers these changes, as well as new processors and buses. "Perhaps the biggest change in version 2.4--one that will affect every driver author--is the incorporation of fine-grained locking in the kernel," says Corbet. "In 2.0, everything was protected by the 'big kernel lock,' and device drivers had no need to deal with concurrency on SMP systems. Version 2.2 had split that up somewhat, but it's only in 2.4 that locking has, in many cases, been pushed down into the driver level itself. Any device driver that is not written with SMP in mind is not correct in 2.4."
You don't have to be a kernel hacker to understand and enjoy this book; all you need is an understanding of C and some background in Unix system calls. Drivers for character devices, block devices, and network interfaces are all described in step-by-step form and are illustrated with full-featured examples that show driver design issues, which can be executed without special hardware. Major changes in the second edition include discussions of symmetric multiprocessing (SMP) and locking, new CPUs, and recently supported buses. For those who are curious about how an operating system does its job, this book provides insights into address spaces, asynchronous events, and I/O.
Chapter 3, "Char Drivers," is available free online.
More information about the book, including Table of Contents, index, author bio, and samples.
The O'Reilly Network Linux DevCenter.
A cover graphic in jpeg format.
Drivers, 2nd Edition
By Alessandro Rubini & Jonathan Corbet
2nd Edition July 2001
0-59600-008-1, 586 pages, $39.95
O'Reilly Media spreads the knowledge of innovators through its books, online services, magazines, and conferences. Since 1978, O'Reilly Media has been a chronicler and catalyst of cutting-edge development, homing in on the technology trends that really matter and spurring their adoption by amplifying "faint signals" from the alpha geeks who are creating the future. An active participant in the technology community, the company has a long history of advocacy, meme-making, and evangelism.
PRESS QUERIES ONLY