The I/O System is the component of the OS responsible for managing communication between the CPU and peripheral devices (disks, keyboards, network cards, GPUs). Efficient I/O management is critical because I/O devices are orders of magnitude slower than the CPU.
The CPU continuously checks the device's status register in a tight loop until the device is ready. The CPU is completely wasted during this polling loop—it cannot do any other work.
The CPU initiates an I/O operation and then continues executing other processes. When the device completes the operation, it sends a hardware interrupt. The CPU handles the interrupt, processes the data, and resumes.
For bulk data transfers (reading a large file from disk), the CPU programs a DMA Controller with the source address, destination address, and byte count, then goes back to executing other processes. The DMA controller transfers the data directly between the device and main memory without any CPU intervention. Only one interrupt is generated when the entire transfer is complete.
The I/O system is organized into layers:
printf(), scanf().Spooling (Simultaneous Peripheral Operations On-Line) is a technique where data is temporarily held in a buffer (usually on disk) to be processed by a slower device. The classic example is a Print Spooler: multiple applications send print jobs to a spool directory, and the printer processes them one at a time in order.