O’Reilly news

"Linux Device Drivers" updated for Linux 2.4

July 9, 2001

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.

Online Resources:

Linux Device Drivers, 2nd Edition
By Alessandro Rubini & Jonathan Corbet
2nd Edition July 2001
0-59600-008-1, 586 pages, $39.95

About O’Reilly

O’Reilly, the premier learning platform for technology professionals, offers the industry’s most extensive catalog of high-quality technical and professional skills development courses. From AI, programming, and cloud technologies to essential business skills such as leadership training and critical thinking, O’Reilly delivers highly trusted content from its network of renowned experts that meets a diverse array of learning needs, with over 5,000 role-based on-demand courses, nearly 200 live events each month, access to interactive sandboxes and labs, and more. For more information, visit www.oreilly.com.

Email a link to this press release