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

The Problem

Each hardware device has unique control mechanisms, register layouts, and command sets. The OS cannot contain code for every possible device — it would be enormous and impossible to maintain.

Core Idea

A device driver is a software module that translates generic OS I/O commands into device-specific instructions, acting as the intermediary between the OS and hardware.

How It Works

  1. OS sends a generic I/O request (e.g., “read sector 120”) to the driver
  2. Driver translates this into device-specific commands and register writes
  3. Driver writes commands to the device controller’s registers
  4. Driver may set up DMA transfers or prepare for interrupt notification
  5. On completion, driver processes the interrupt and updates OS state
device_driver OS Operating System Driver Device Driver (Software) OS->Driver generic command (e.g., read sector) Driver->OS completion status Regs Device Controller Registers Driver->Regs specific commands & register writes Regs->Driver interrupt Device Physical Device Regs->Device hardware signals Device->Regs status/interrupt

Key Properties

  • Runs in kernel mode with privileged access
  • Device-specific but presents uniform interface to OS
  • Handles device initialization, error detection, and status reporting
  • Four main types: character, block, network, and virtual drivers

Connections

Edge Cases & Gotchas

  • A buggy driver can cause kernel panics or system crashes
  • Driver must handle concurrent requests properly (reentrant code)
  • Missing drivers result in “unknown device” errors
  • Driver version must match kernel version exactly