Device
- source
- How Linux Works
Device files as device I/O interface
not all devices have device files
e.g., network interfaces, should be like character devices, but due to the difficulty using file interfaces, the kernel offers other I/O interfaces
Block device
file type: b
program access data from a block device in fixed chunks
total size is fixed -> easy to split and index
disk device is a type of block device
Character device
file type: c
work with data streams: read/write data with character device
don’t have size
example: printer
Pipe device
file type: p
like character device, but with another process ar the end of I/O stream instead of a kernel driver
Socket device
file type: s
used for interprocess communication, usually outside of /dev directory
sysfs device path