How Hardware Detection Works
This document sets out to explain for the typical user how hardware detection works in Ubuntu. Novice users will hopefully find this a useful introduction to some of the more interesting parts of the system and experienced users will gain a deeper understanding and be better able to investigate when things don't work.
Because this document is aimed at everybody, it explains things that may already be known to those familar with Ubuntu and other Linux and UNIX systems; experienced users may skip those parts at their leisure though should beware of missing information they may not already know.
Like all modern operating systems, Ubuntu is structured much like an onion with the most critical parts in the centre and programs run by users on the outer layers. This design gives both good security, reliability and efficiency.
The centre-most part of the system is known as the Kernel, the particular kernel used by Ubuntu is called Linux and is itself modelled on the kernel of the UNIX system.
The primary job of the kernel is to manage all of the other programs running on the computer (known as processes), allocating time for each of them to run and thus giving the appearance of a system where multiple processes may be running at the same time.
The kernel runs in a privileged state on the system with direct access and communication to all of the hardware and memory. All other processes on the system must go through the kernel to talk to hardware, including the disks and memory, thus the kernel is able to enforce security and prevent both processes and users from doing things that they should not be permitted to do.
With the large diversity of difference pieces of hardware available for computers, it's not possible for a single piece of software to know how to talk to every device in existance. Instead the knowledge of how to talk to a particular type of device is written into a piece of software called a driver which then presents an interface to both the kernel and other processes.
If the kernel were to include a driver for every known piece of hardware it would be enormous and take up far more memory than is available on many systems, therefore all except the very core drivers are separated out into loadable modules (usually just called modules) -- code stored in a separate file that can be loaded into the running kernel when needed.
One of the main goals of hardware detection is to ensure the right drivers are loaded for the system so that all of the hardware can be used.