I/O Systems Overview
A computer isn't very useful without ways to get data in and out! The I/O (Input/Output) system connects the CPU and memory to the outside world - keyboards, displays, networks, storage devices, and more.
I/O Organization
I/O System Architecture
+---------------------------------------------+
| |
| +-----------+ +-----------+ +--------+ |
| | | | | | | |
| | CPU | | Memory | | I/O | |
| | | | | | Bridge | |
| +-----+-----+ +-----+-----+ +----+---+ |
| | | | |
| +-------+-------+--------------+ |
| | |
| System Bus / Interconnect |
| | |
| +-------+-------+-------+ |
| | | | | |
| v v v v |
| +---+ +---+ +---+ +---+ |
| |USB| |SATA| |PCIe| |NIC| |
| +---+ +---+ +---+ +---+ |
| | | | | |
| Mouse Disk GPU Network |
+---------------------------------------------+
I/O Methods
There are three main methods for I/O operations:
- Programmed I/O: CPU directly controls each data transfer (simple but slow)
- Interrupt-Driven I/O: CPU starts transfer, then does other work until interrupted
- Direct Memory Access (DMA): Specialized hardware handles the transfer
I/O Addressing
Two main approaches to accessing I/O devices:
- Memory-Mapped I/O: Devices share the same address space as memory
- Isolated I/O: Devices have a separate address space with special instructions
Memory-Mapped I/O
+---------------------------------------------+
| Address Space |
| 0x00000000 - 0x7FFFFFFF: Main Memory |
| 0x80000000 - 0xBFFFFFFF: I/O Devices |
| 0xC0000000 - 0xFFFFFFFF: ROM/Reserved |
+---------------------------------------------+
I/O Performance
I/O performance is often the bottleneck in a system. Key metrics include:
- Bandwidth: Amount of data transferred per second (MB/s or GB/s)
- Latency: Time from request to completion
- IOPS: I/O Operations Per Second (for storage devices)
- CPU Overhead: Percentage of CPU time spent on I/O
Modern I/O systems use techniques like buffering, caching, and DMA to minimize CPU involvement and maximize throughput.