Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 05 · How Computers Work · Talking to the kernel · about 15 min to read

Play it as a journeyTutor comes with a plan

Talking to the hardware: device drivers

IO Interrupts and the Bus
IO Interrupts and the Bus · Open board

A device ringing for the CPU’s attention, and the shared wiring that carries the data. This lesson opens the box marked “driver” on that drawing.

Before you start. I/O, Interrupts & the Bus gave you three ideas: an interrupt is a device telling the CPU it is ready, DMA (direct memory access) lets a device move data into memory without the CPU copying it, and a driver is the kernel code that speaks one device’s private language. Capstone: Keypress → Pixel showed a driver reading a number off a keyboard as if it were memory. The tap on the shoulder covered signals, which tap a program from outside. This lesson shows how a driver really does all of that, step by step.

Lesson 30 of 41 in How Computers Work

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 2003: most Windows crashes come from drivers
  • A device register: a number the device watches
  • The ring: a shared list of jobs in RAM
  • The interrupt, again: one bell for many packets
  • The driver: four jobs
  • A simulated card and its driver
  • What a real Linux driver looks like
  • Edge cases and real systems

Terms it explains: device register, memory-mapped I/O, MMIO, descriptors, ring, doorbell, driver, blocking I/O, bootloader (GRUB), bus, device driver, DMA, event loop, firmware (BIOS/UEFI), I/O-bound vs CPU-bound, init / systemd, interrupt, ISR / interrupt handler, non-blocking / async I/O, polling, timer interrupt.

Lab

The device taps the CPU on every event. What happens when it taps a million times a second?

Open Let the device tap you every time, push Events a second arriving to the top, and watch the share of arrivals handled.

Open The interrupt storm

Your write returned and the power cut a moment later. Is the record on the disk?

Click After every record, then Every 1,000 records, drag Where the power cuts, and watch Lost on the crash.

Open The fsync interval

Review How Computers Work