Devices
The program/library that handles various read/write operations and converts it to the actual on-the-wire instructions that will control the chipset in the target hardware (e.g over the IO Ports or Memory Maps set up via ACPI or PCI)
A lot of hardware is expected to follow certain standards (e.g. a standard like USB, ACPI, PCI) which will dictate a common set of instructions that can be used with that compliant hardware - so it can be possible to write generic drivers for a class of devices.
In Linux, most device drivers are statically-linked into the kernel, but the kernel can be extended with Modules
Device Types
There are three main kinds of devices:
Char Devices
- Accessible through /dev
- Usually implements read/write/open/close semantics
- char devices (unlike a file) can typically only be accessed sequentially - once data is consumed from the device, you can’t rewind and replay
Block Devices
- Accessible through /dev
- Block devices require I/O operations that work at block size
- Linux provides interfaces to treat block devices like char devices (reading/writing smaller amounts of data) but internally handles it differently
Network Devices
- Interaction happening through a Networking interface (note that this includes virtual devices like the loopback interface)
- Different from char and block devices as there are semantics required around establishing connections - writing and reading data from an interface by itsefl doesn’t make sense