• ↑↓ pour naviguer
  • pour ouvrir
  • pour sélectionner
  • ⌘ ⌥ ↵ pour ouvrir dans un panneau
  • ←→ pour naviguer
  • esc pour rejeter
⌘ '
raccourcis clavier

The Problem

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.

Core Idea

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.

How It Works

  1. Application calls fopen("data.txt", "r") or read(fd, buf, size)
  2. OS checks file permissions, locates file on disk, allocates buffer
  3. Device-Independent Layer determines which device and driver to use, handles buffering
  4. Device Driver translates “read sector 120” into register writes for the disk controller
  5. Device Controller executes: seeks to track, waits for sector, reads data
  6. Interrupt signals completion; CPU processes interrupt, copies data to user buffer
  7. Application resumes with data available
io_flow App 1. Application fopen/read/write OS 2. OS Checks permissions, file lookup App->OS Indep 3. Device-Independent Layer buffering, device selection OS->Indep Driver 4. Device Driver translate to HW commands Indep->Driver Ctrl 5. Device Controller execute on hardware Driver->Ctrl Int 6. Interrupt Handler process completion Ctrl->Int interrupt Done 7. Back to Application data available Int->Done

Key Properties

  • 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

Connections

Edge Cases & Gotchas

  • 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)