← Interview Prep

Linux Kernel — I/O Architecture & Device Drivers

How the kernel talks to hardware: character vs block vs network devices, major/minor & /dev, the device model (bus→device→driver, probe, hotplug) via sysfs & udev, and how a driver moves data — MMIO registers, interrupts, and DMA — plus the character-driver file_operations/ioctl interface.

How the kernel talks to hardware — the device model, the three device classes, and how a driver actually moves data (registers, interrupts, DMA). Original, interview-focused notes.

Devices are exposed as files under /dev and organized by the device model under /sys. A driver binds to a device on a bus, registers a set of operations, and moves data via memory-mapped registers + interrupts + DMA.

Three classes of device

ClassAccessExamples
CharacterByte stream, no seek buffering — read/write directlytty, serial, /dev/null, input
BlockFixed-size blocks, random access, via the page cache & block layerDisks, SSDs, NVMe — see Block Devices
NetworkNot a /dev file — packets via the socket/net stackNICs (eth0)

Each device node has a major number (which driver) and minor (which instance). ls -l /dev shows c/b and the major,minor.

The device model: sysfs & udev

How a driver moves data

The efficient pattern: DMA moves the bytes, one interrupt signals completion, a bottom half processes the result — minimal CPU per byte. PIO (CPU copies each word) is only for tiny/slow devices.

The character-driver interface

A char driver registers file_operations (open, read, write, ioctl, mmap) so its /dev node behaves like a file. ioctl is the catch-all for device-specific control that doesn't fit read/write.

Likely interview questions

Kernel Internals series. Related: Block Device Drivers · Interrupts.