How Android works
The Linux kernel
The engine under everything — and what Android bolted onto it.
4 pages62 min4 interactive9700 words
- 01Android's kernel, and its androidismsAndroid runs on Linux, but not quite the Linux you would install on a server. This page is about the four jobs the kernel does for Android, the handful of features Android bolted on, and what happened to each of them.intermediate15 mininteractive
- 02Branches, GKI and the KMIFor years every phone shipped a different kernel, and a security fix could take years to arrive. GKI made the kernel a single signed binary and moved board support into loadable modules behind a frozen interface.nerd15 mininteractive
- 03Wakelocks and the art of sleepingA phone must sleep to survive, and must wake to be useful. The machinery that decides which is a story about a rejected kernel patch, a userspace dialect, and the cheapest way to keep a CPU alive.intermediate15 mininteractive
- 04The kernel features Android leans onSeven kernel facilities Android could not work without: Binder, memfd, cgroups and PSI, SELinux, seccomp, DMA-BUF heaps and eBPF — plus the filesystems that make read-only system images cheap.nerd17 mininteractive
Test yourself
Test yourself: The Linux kernel
Order the steps of the SystemSuspend suspend thread's loop, from first to last.
Drag, or use the arrows to reorder.
- 1Wait for the wake lock counter to reach zero
- 2Write the saved value back to /sys/power/wakeup_count
- 3Write mem to /sys/power/state
- 4Read /sys/power/wakeup_count