Fundamentals 10 min read

Understanding Computer Buses and I/O: From Data Bus to Linux Drivers

This article explains how computer buses work, the different types of buses, the role of I/O device interfaces, device controllers, DMA and interrupt controllers, and how Linux implements device drivers to provide a unified I/O subsystem.

Ops Development Stories
Ops Development Stories
Ops Development Stories
Understanding Computer Buses and I/O: From Data Bus to Linux Drivers

Bus

Intel uses a Dual Independent Bus (DIB) that connects an external front‑side bus to main system memory and an internal back‑side bus to one or more CPUs and caches. The CPU memory interface talks directly to the system bus, which then connects to an I/O bridge. The bridge links the memory bus to an I/O bus for peripheral devices.

Physically, a bus can be viewed as a set of wires. There are five common types:

Data Bus: transfers data between the CPU and RAM.

Address Bus: specifies the memory addresses of data stored in RAM.

Control Bus: carries control signals from the CPU’s control unit to peripheral devices such as USB and IEEE‑1394.

Expansion Bus: connects expansion slots and cards to the computer.

Local Bus: provides higher‑speed data transfer for specific components.

I/O Devices

Each I/O device consists of an interface and the actual device. Devices are not connected directly to the bus; they communicate through their interface, which links to the bus and then to the CPU. Examples of interfaces include IDE, SCSI, SAS, SATA, and Fibre Channel, each requiring appropriate driver support.

Device Controllers

The interface itself acts as the device controller. The CPU interacts with the controller rather than the raw hardware. Controllers perform several critical tasks:

Continuously monitor device status and enable control operations.

Contain three registers—Status, Command, and Data—each mapped to an I/O port accessible via special assembly instructions (e.g., in/out).

Provide data buffers for devices such as printers, allowing memory‑mapped I/O.

Detect transmission errors, set error flags, report to the CPU, and request retransmission.

Device Drivers

Device drivers are programs that manage and operate hardware by accessing the controller’s registers. Their main functions are to initialize the device, start and stop it, transfer data between the device and the kernel, and handle errors.

Initialize the device.

Start the device and shut it down.

Receive data from the device and pass it to the kernel.

Send data from the kernel to the device.

Detect and handle device errors.

DMA Controllers

Devices that move large amounts of data, such as disks, use Direct Memory Access (DMA) to transfer data without CPU intervention. A DMA controller coordinates these transfers.

The CPU issues a command to the DMA controller specifying the amount of data and destination address.

The DMA controller instructs the disk controller to move data into memory, performing error checking.

The disk controller writes the data to memory via the memory bus.

Upon completion, the disk controller signals the DMA controller.

The DMA controller raises an interrupt to notify the CPU that the transfer is finished.

Interrupt Controllers

When a device finishes a task it triggers an interrupt; the interrupt controller notifies the CPU, which pauses its current work to handle the interrupt. Device drivers register an interrupt handler (typically the do_IRQ entry point) that dispatches to the specific handler.

Implementation of Disk Drivers in Linux

In Linux, a device driver is a collection of related functions that include service routines and interrupt handlers. Drivers interact with the kernel through the

file_operations

structure, linking device operations to the file system. They run in kernel mode, provide a uniform interface, can use kernel services (memory allocation, interrupt handling, wait queues), are often loadable as modules, and can be configured at compile time or runtime.

Drivers are part of the kernel; bugs can crash the system or corrupt data.

They provide a standard interface to the kernel or other subsystems.

They use kernel services such as memory allocation, interrupt handling, and wait queues.

Most are loadable modules, allowing dynamic loading and unloading.

They can be configured when the kernel is built or at runtime.

Linux I/O Overview

Because many manufacturers produce diverse devices, drivers abstract differences and expose a unified file‑system‑based interface to user space.

DMALinux kerneldevice driversbus architectureI/O devices
Ops Development Stories
Written by

Ops Development Stories

Maintained by a like‑minded team, covering both operations and development. Topics span Linux ops, DevOps toolchain, Kubernetes containerization, monitoring, log collection, network security, and Python or Go development. Team members: Qiao Ke, wanger, Dong Ge, Su Xin, Hua Zai, Zheng Ge, Teacher Xia.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.