How Android Uses a Modified Linux Kernel
The Android operating system relies on a customized version of the open-source Linux kernel to serve as its core foundation for hardware management, security, and low-level system services. While Android retains fundamental Linux features—such as process scheduling, memory allocation, and networking—Google introduced critical modifications tailored specifically to the resource constraints, battery requirements, and unique user experience demands of mobile devices.
The Foundation: Standard Linux Capabilities
At its base, Android uses the Linux kernel as a hardware abstraction layer (HAL). The kernel enables Android to interface directly with device hardware, such as processors, display controllers, cameras, flash storage, and wireless radios.
In addition to hardware communication, Android uses the standard Linux multi-user model for security. Instead of assigning user IDs (UIDs) exclusively to physical people, Android assigns a unique UID to each installed application. This creates an isolated software sandbox that prevents applications from accessing each other's data without explicit permission.
Key Modifications Introduced by Android
To make the Linux kernel suitable for mobile devices, Android developers added several proprietary subsystems and architectural enhancements:
1. Binder (Inter-Process Communication)
Standard Linux supports traditional Inter-Process Communication (IPC) mechanisms like sockets and shared memory. However, Android introduced Binder, a specialized IPC system optimized for mobile performance and security. Binder provides high-speed, remote procedure call (RPC) mechanisms with built-in reference counting and UID verification, enabling sandboxed apps to securely communicate with core system services.
2. Low Memory Killer (LMK)
Standard Linux handles low-memory scenarios using an Out-of-Memory (OOM) killer, which acts as a last resort to keep the system running. Because mobile devices frequently exhaust available RAM, Android implemented the Low Memory Killer (and later userspace LMKD). This system categorizes running applications based on their state—such as foreground, visible, service, or background—and systematically terminates non-essential background processes before memory pressure degrades user responsiveness.
3. Ashmem (Anonymous Shared Memory)
Android added Ashmem, an alternative to standard POSIX shared memory. Ashmem allows processes to share memory buffers while giving the kernel permission to reclaim those memory pages if the system runs low on RAM and the processes are not actively using them.
4. Specialized Power Management (Wakelocks)
Battery conservation is critical for mobile architectures. Android introduced Wakelocks into the kernel to alter the standard Linux power state. When an Android device screen turns off, the kernel attempts to place the CPU into a deep sleep state. A wakelock allows an active process (such as audio playback or an incoming call handler) to prevent the CPU from entering low-power sleep until the task completes.
Evolution Toward Upstream Linux and the Generic Kernel Image
Historically, the Android kernel diverged significantly from the mainline Linux kernel maintained by the open-source community. This separation created fragmentation, as device manufacturers had to apply extensive patches to support specific chipsets.
In modern versions of Android, Google introduced the Generic Kernel Image (GKI) architecture. The GKI decouples the core system kernel from vendor-specific hardware drivers using loadable kernel modules and stable interfaces. This initiative aligns Android much closer to the upstream Linux kernel, streamlining system security updates and reducing the engineering overhead required to maintain Android across diverse hardware platforms.