I/O and device drivers
Device drivers in the UNIX system
provide an interface to peripheral devices
that is hardware-independent,
just as they do in DOS systems.
A programmer can write a program that outputs to
disk, terminals, or printer
without concern for the details
of interfacing with the hardware.
The hardware interface only needs to be written once
and then utilized many times.
Device I/O in the UNIX system
differs from the DOS implementation
in two significant ways:
-
Multiple tasks access the device concurrently.
This gives the device driver writer
the opportunity to optimize hardware accesses between tasks.
For example, a driver for a hard disk
can delay access to disk blocks far away from
the current head position
by batching these requests for execution at a later time.
Because the UNIX operating system is multithreaded,
another process can execute
while the first process waits for the disk.
-
Data sent to the device may not actually
be written to the device immediately
because of operating system buffering.
This increases the efficiency and throughput
of the operating system,
although it may delay an individual write operation
for peripherals such as disks and serial devices.
Flushing the buffers forces data to the device
but can greatly decrease the overall O/S efficiency.
-
I/O port access is possible only in kernel mode.
This is addressed by linking the device driver
into the kernel.
© 2005 The SCO Group, Inc. All rights reserved.