linux device file
I am new to Linux, and currently reading "understanding the Linux Kernel, 3rd Edition By Daniel P. Bovet, Marco Cesati".
In chapter 13.3, it says that:
I/O devices are treated as special files called device files. According to the characteristics of the underlying device drivers, device files can be of two types: block or character.
My question is that, PC has many IO devices such as "DMA controller, timer, etc",
Then obviously these devices canít be classified as either block or character.
Then how does Linux deal with these devices? And what is the point to just classify the devices to "block or character", since there are so many exceptions?
In Linux the word "device" has a particular meaning. A device is something that the kernel can read from or write to. The kernel spends much of its time shifting data about, for example from a terminal keyboard to memory to disk, and back from the disk to memory to a terminal screen. This can be transferred character by character (as with a port) or in blocks (as with a disk).
So a terminal, a sound card or a usb port is a Linux device but a controller is just a piece of hardware. It needs a driver (which will be inside the kernel, probably as a loadable module) but it doesn't have any data transferred to or from it, either in blocks or in characters.