When an application calls read("data.txt"), how does this high-level request end up causing a disk head to move and data to appear in memory? The journey from software request to hardware action is complex.
Transforming an I/O request into hardware operation is a multi-step process where the request flows down through I/O software layers, gets translated into hardware commands, executes on the device, and returns data via interrupts.
- Application calls
fopen("data.txt", "r")orread(fd, buf, size) - OS checks file permissions, locates file on disk, allocates buffer
- Device-Independent Layer determines which device and driver to use, handles buffering
- Device Driver translates “read sector 120” into register writes for the disk controller
- Device Controller executes: seeks to track, waits for sector, reads data
- Interrupt signals completion; CPU processes interrupt, copies data to user buffer
- Application resumes with data available
- Each step adds appropriate abstraction or translation
- DMA can bypass CPU involvement in data transfer (steps 5-6)
- The process is asynchronous — application may block until interrupt arrives
- File system layer maps logical file operations to physical disk blocks
- Built from: O System, Device Driver, Device Controller
- Builds into: DMA, Interrupt Handler
- Related: O Software Structure, Polling, System Bus
- Contrasts with: O Software (only handles step 1)
- Page fault can occur during copy to user buffer, complicating the flow
- Disk may return errors (bad sector) that must be handled at each layer
- Concurrent I/O requests require proper queue management
- DMA setup failure falls back to programmed I/O (very slow)