How Linux Reads Its Hardware
If you’ve ever used htop — the live system monitor — and seen the CPU percentages and memory bars shifting in real time, you’re watching Linux translate raw hardware data into something human-readable. But where do those numbers actually come from? This article explains how Linux and other Unix-like systems discover, track, and report information about your hardware.
1 — Hardware is just switches and electricity
Your CPU, RAM, temperature sensors — at the lowest level, they are circuits. Voltage levels. Numbers encoded in electrical signals.
The problem: your programs cannot just reach in and touch hardware directly. That would be chaos — every program fighting over the same wires.
So the kernel steps in.
2 — The kernel is the one boss
When Linux boots, the kernel loads first. It is the only program allowed to talk directly to hardware.
Everything else — your browser, htop, even the shell — has to ask the kernel for anything hardware-related. This split is called user space (your programs) versus kernel space (the boss).
3 — Programs ask through files
The kernel could have invented a special language for requests. Instead it did something clever.
It made hardware look like files.
Files are something every program already knows how to read. So the kernel said: fine, I will pretend everything is a file. This is the Unix philosophy and it runs through everything.
4 — /proc is a fake filesystem
/proc does not exist on your hard drive. Nothing is stored there. When a program opens /proc/stat, here is what actually happens:
The program asks the kernel to open the file. The kernel sees the path starts with /proc. Instead of going to disk, it generates the answer on the spot from live data already in memory, then hands it back as if it were a real file.
The kernel is generating the contents at the exact moment you read it. /proc/meminfo, /proc/cpuinfo — same story. None of it is stored anywhere. All generated live. This is where htop gets its memory and CPU numbers.
5 — /sys is the same idea, more organized
/sys works the same way but with more structure. Each piece of hardware gets its own folder. Inside are tiny files, each exposing exactly one number.
For example, one file contains the current clock speed of CPU core 0. The kernel generates it fresh every time anything reads it. Nothing was fetched or stored — the kernel just says: you asked, here is what the hardware says right now.
6 — This is where temperature comes from
Your CPU has a built-in thermometer. When something reads the right file under /sys/class/thermal/, the kernel asks the hardware driver for the current value and hands it over.
The program divides by 1000 — because the kernel reports millidegrees — and shows you the result in °C.
No magic. Hardware to kernel to fake file to your program.
7 — The full picture
Layer Description
--------------------------- ------------------------------------------------
CPU, RAM, sensors Real hardware
Kernel Only layer that touches hardware
/proc and /sys Fake filesystems, generated on demand
htop Reads them like normal files: open, read, close
Numbers on screen temp, freq, memory, cpu%
The key insight
When htop shows CPU frequency, temperature, memory usage — none of that data traveled over a network. None of it came from a database. It did not come from anywhere that was sitting around waiting.
The kernel watches the hardware constantly and lets programs peek at what it knows — through the illusion of files.
That is the whole trick.
Ben Santora - March 2026