Specifications

D
evice Driver Programming
17-2
What Are the Advantages and Disadvantages of a User-Level Driver?17
The chief advantage of a user-level device driver is that it provides a low-overhead method
of performing I/O operations. Without a user-level device driver, you must use system
calls to perform I/O operations--a procedure that is costly in terms of time and overhead.
A system call involves crossing the user-kernel boundary and several layers of kernel rou-
tines before finally calling the device driver routine associated with the particular system
call. After the kernel device driver performs the bulk of the work required for completion
of the requested I/O operation, the same path must be traced back through the various
layers to exit the kernel. A user-level device driver provides a means of performing I/O
operations without having to enter and exit the kernel.
Other advantages of a user-level device driver include the following:
It provides faster access to the I/O and control functions of a device.
It does not require that the kernel be modified or rebooted.
It can permit I/O operations to be performed directly to a user process’s
data region.
It can be designed to provide an interface to the device that is similar to the
system call interface.
It can be implemented by using much of the same program code that is
used in a kernel device driver.
It is developed by using interfaces that shall continue to be supported in
subsequent releases of the operating system. (Kernel device drivers use
internal kernel routines that are subject to modification with subsequent
releases of the operating system.)
One of the major disadvantages of a user-level device driver is that the user interface is not
uniform for all devices. Other disadvantages of a user-level device driver include the
following:
It uses features of the operating system that hinder portability of the user-
level device driver.
Calls to its routines do not comply with existing standards.
It does not effectively restrict read and write access to a device that it
controls.
It provides no protection for malicious or incorrect use of the user
interfaces and system resources (for example, system memory, system reg-
isters, and the I/O subsystem).
It requires that the user application initialize the buffers before calling the
driver’s I/O routines.
It requires that you have certain privileges to access a device that it
controls. To perform some functions, you must have the P_PLOCK,
P_SHMBIND, or, if applicable, the P_USERINT privilege.
The user must ensure that a kernel device driver cannot be used
simultaneously to access a device controlled by the user-level driver.