Device Drivers Block and Character Devices
The role of device drivers is to communicate with I/O devices attached to the system; for example, hard disks, floppies, interfaces, sound cards, and so on. In accordance with the classical Unix maxim that ''everything is a file," access is performed using device files that usually reside in the /dev directory and can be processed by programs in the same way as regular files. The task of a device driver is to support application communication via device files; in other words, to enable data to be read from and written to a device in a suitable way.
Peripheral devices belong to one of the following two groups:
1. Character Devices — Deliver a continuous stream of data that applications read sequentially; generally, random access is not possible. Instead, such devices allow data to be read and written byte-by-byte or character-by-character. Modems are classical examples of character devices.
2. Block Devices — Allow applications to address their data randomly and to freely select the position at which they want to read data. Typical block devices are hard disks because applications can address any position on the disk from which to read data. Also, data can be read or written only in multiples of block units (usually 512 bytes); character-based addressing, as in character devices, is not possible.
Programming drivers for block devices is much more complicated than for character devices because extensive caching mechanisms are used to boost system performance.
Continue reading here: Networks
Was this article helpful?