Block I/O Devices vs. Character I/O Devices
We can further divide computer devices into the following two categories: Block Devices and Character Devices.
- This division is about the amount of data that the computer can transfer to or from a device at once.
- Block devices can be accessed one block at a time. A block is a fixed size of data, usually standing at a multiple of 512 bytes. Block sizes of 4k (= 4096) and 8k (= 8192) bytes are common.
- The blocks we are talking about here are different from cache blocks. The RAM's page size, on the other hand, is usually a multiple of a block size.
- Examples of block devices include hard disk drives, solid-state drives, and USB flash drives.
- Character devices can be accessed one byte at a time (remember that 1 byte can store exactly one ASCII character or a small integer between 0-255.)
- Examples of character devices include the mouse, the keyboard, and the monitor. CPU, RAM, and cache are character devices, too, because we can access a single byte on each of these.
- As a general rule, every non-storage peripheral device is a character device.