July 10, 2001

Linux Device Drivers updated for Linux 2.4

Author: JT Smith

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 co-author of the new, second edition of "Linux Device
Drivers" (O'Reilly $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.


Additional Resources: 

Chapter 3, Char Drivers, is available free online at: 

http://www.oreilly.com/catalog/linuxdrive2/chapter/ch03.html
An interview with the authors is available online:
http://linux.oreilly.com/news/lddans_0601.html

For more information about the book, including Table of Contents, index, 
author bio, and samples, see:
http://www.oreilly.com/catalog/linuxdrive2/

The O'Reilly Network Linux DevCenter:
http://www.oreillynet.com/linux/

For a cover graphic in jpeg format, go to:
ftp://ftp.ora.com/pub/graphics/book_covers/hi-res/1565926099.jpg


Linux Device Drivers, 2nd Edition 
By Alessandro Rubini & Jonathan Corbet
2nd Edition July 2001 
0-59600-008-1, 586 pages, $39.95
order@oreilly.com
1-800-998-9938
http://www.oreilly.com
###
Click Here!