Labels

Sunday, 24 May 2015

Types of Device Drivers???

A device driver is a software module that resides within the Digital UNIX kernel and is the software interface to a hardware device or devices. A hardware device is a peripheral, such as a disk controller, tape controller, or network controller device. In general, there is one device driver for each type of hardware device. Device drivers can be classified as:
  • Block device drivers
  • Character device drivers (including terminal drivers)
  • Network device drivers
  • Pseudo device drivers
  •  Block Device Driver
A block device driver is a driver that performs I/O by using file system block-sized buffers from a buffer cache supplied by the kernel. The kernel also provides for the device driver support interfaces that copy data between the buffer cache and the address space of a process.
Block device drivers are particularly well-suited for disk drives, the most common block devices. For block devices, all I/O occurs through the buffer cache.
  •  Character Device Driver

A character device driver does not handle I/O through the buffer cache, so it is not tied to a single approach for handling I/O. You can use a character device driver for a device such as a line printer that handles one character at a time. However, character drivers are not limited to performing I/O one character at a time (despite the name ``character'' driver). For example, tape drivers frequently perform I/O in 10K chunks. You can also use a character device driver when it is necessary to copy data directly to or from a user process.
Because of their flexibility in handling I/O, many drivers are character drivers. Line printers, interactive terminals, and graphics displays are examples of devices that require character device drivers. 

A terminal device driver is actually a character device driver that handles I/O character processing for a variety of terminal devices. Like any character device, a terminal device can accept or supply a stream of data based on a request from a user process. It cannot be mounted as a file system and, therefore, does not use data caching. 

  • Network Device Driver

A network device driver attaches a network subsystem to a network interface, prepares the network interface for operation, and governs the transmission and reception of network frames over the network interface. This book does not discuss network device drivers. 

  • Pseudo device Driver

Not all device drivers control physical hardware. Such device drivers are called "pseudo device'' drivers. Like block and character device drivers, pseudo device drivers make use of the device driver interfaces. Unlike block and character device drivers, pseudo device drivers do not operate on a bus. One example of a pseudo device driver is the pseudo terminal or pty terminal driver, which simulates a terminal device. The PTYterminal driver is a character device driver typically used for remote logins.


When the Kernel Calls a Device Driver



 Some of these requests, such as input or output, result directly or indirectly from corresponding system calls in a user program. Other requests, such as the calls at auto configuration time, do not result from system calls but from activities that occur at boot time.

 case study:

Example of Reading a Character

This section provides an example of how Digital UNIX processes a read request of a single character in raw mode from a terminal. (Raw mode returns single characters.) Although the example takes a simplified view of character processing, it does show how control can pass from a user program to the kernel to the device driver. It also shows that interrupt processing occurs asynchronously from other device driver activity.
figure summarizes the flow of control between a user program, the kernel, the device driver, and the hardware. The figure shows the following sequence of events:
  • A read request is made to the device driver (C-1 to C-3).
  • The character is captured by the hardware (I-4 and I-5).
  • The interrupt is generated (I-6).
  • The interrupt handler services the interrupt (I-7 to I-9).
  • The character is returned (C-10 to C-13).
figure provides a snapshot of the processing that occurs in the reading of a single character. The following sections elaborate on this sequence.

Figure 1-3: Simple Character Driver Interrupt Example


No comments:

Post a Comment