Character and Block Devices

Two types of devices can represent physical and virtual devices in Linux:

■ Character devices are those whose communication is based on a serial communication character by character. Common character devices are your serial ports (/dev/ttyS0, /dev/ttyS1, and so on) and the /dev/random device, which is a virtual device that if read will just feed out a string of random bytes. The latter is useful for creating an empty file that contains actual data.

■ Block devices are those whose communication is based on multiple bytes that are read and written as a unit known as a block. All disk devices are block devices. On recent Linux versions, SCSI and IDE hard disks will be seen as /dev/sda, /dev/sdb, and so on. CD and DVD devices will typically be seen as / dev/sr0, /dev/srl, and so on.

You will come across more block and character devices throughout the book.

Was this article helpful?

0 0

Post a comment