Download Device Driver

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Device Driver
Introduction
The operating system controls the computer’s input output devices. It provides an
interface between the devices and the rest of the system, which is easy and simple. This
interface must be device independent as far as possible.
Input output devices are of many types – floppy disk drives, hard disk drives and
CD drives provide i/o to/from secondary storage devices, network controllers allow data
communication over channels (cables, infrared or radio) between computers, display
controllers allow data to be displayed on terminals, keyboard controllers allow character
input from keyboards. Other devices include mice, A/D convertors connected to any of a
number of different types of sensors of physical variables such as temperature, pressure,
wind velocity, etc., audio and video grabber cards that are specialized A/D convertors for
acquiring sound and video data, sound cards incorporating sound synthesizing chips, etc.
These devices can be viewed from a number of perspectives. At the hardware
level they comprise of motors, power supplies, wires, chips, etc. They are integrated into
hardware modules such as floppy disk drives with an interface to the computer system on
a printed circuit board (that plugs into the motherboard) or a card (such as the PCMCIA
cards) that can be inserted and removed from the system bus. This hardware interface
between the device and the computer is called the device controller. Often one device
controller can control several devices of the same type. To the CPU the controller
presents itself in the form of input and output ports (or memory locations on memory
mapped systems) that can be written for control and read for finding out the status.
Input output devices can be broadly classified into block devices and character
devices. Block devices transfer data in blocks of size usually varying between 512 bytes
and 32K bytes. Disk drives are block devices. Character devices commonly transfer data
one character at a time. Interactive terminals, graphic displays and line printers are
character devices. Some devices do not exactly fit into this classification – for example,
real-time clocks or network interfaces.
The part of the operating system that interacts with the device controllers and
deals with the low level device-dependent software is called the device driver. Device
drivers provide a device independent interface to the rest of the operating system
including user processes. Thus, when a user wants to read or write a file, this is achieved
by a read or write library function call with the appropriate file descriptor or pointer and a
pointer to a buffer of data. This library function call is built upon a similar system call
provided by the operating system. The process of starting the drive motor, waiting for it
to get to the right speed, moving the head to the right cylinder, starting the read/write at
the right sector, etc. is hidden from the user because it is done by the device driver on
behalf of all processes that request such service through the proper operating system
interfaces.
Purpose of a device driver
 Provide a device independent and consistent interface to the rest of the operating
system
 Incorporate low level device dependent software
 Handle requests made by the operating system kernel regarding a particular
device on behalf of user processes
Type of device drivers




Block
Character
Network
Pseudo
Block device drivers



Perform i/o in block sized buffers
Perform i/o through a block cache supplied by the kernel
Suited for disk drives
Character device drivers




Performs i/o in characters at a time
Can acquire variable sized chunks from buffers on the controller sometimes
Can be used to copy data directly to or form a user process when necessary
Suited for line printers, terminals.
Network device driver



Attaches a network subsystem to a network interface
Prepares the network interface for operation
Controls transmission and reception of data frames over the network interface
Pseudo device drivers



Make use of the device driver interface to connect a user process to a replacement
for a physical i/o device
For example, a terminal emulator might use a pseudo device driver to provide
remote login over a network
Ram disks appear like disks but are actually portions of main memory; they allow
fast file operations