mentioned in Chapter 1, Unix-like operating
systems are based on the notion of a
, which is just an information container
structured as a sequence of characters. According to this approach,
I/O devices are treated as files; thus, the same system calls used to
interact with regular files on disk can be used to directly interact
with I/O devices. For example, the same
system call may be used to write data into a regular file or to send
it to a printer by writing to the
According to the characteristics of the underlying device drivers, device files can be of two types: block or character . The difference between the two classes of hardware devices is not so clear cut. At least we can assume the following:
The data of a block device can be addressed randomly, and the time needed to transfer any data block is small and roughly the same, at least from the point of view of the human user. Typical examples of block devices are hard disks, floppy disks, CD-ROM, and DVD players.
The data of a character device either cannot be addressed randomly (consider, for instance, a sound card), or they can be addressed randomly, but the time required to access a random datum largely depends on its position inside the device (consider, for instance, a magnetic tape driver).
Network cards are a remarkable exception to this schema, since they are hardware devices that are not directly associated with files; we describe them in Chapter 18.
In Linux ...