Is Android A Better OS Than Linux?
Android has established itself as an important operating system for mobile devices. Google developed Android as an open source OS based on the Linux kernel. Google selected the Linux kernel because of its proven driver model, existing drivers, process and memory management, networking support and several other core operating system services. However, the Google team had to make several changes to make Android capable of operating mobile devices successfully. Differences with standard Linux are highlighted here.
The target architecture
Although the Linux kernel supports several architectures, right now, Android supports only two: ARM and x86. The ARM platform is more prevalent on mobile phones while the Android-x86 targets mainly the Mobile Internet Devices or MIDs used for general-purpose desktop/laptop/server computing systems. This being the fundamental difference between the two Operating Systems, it provides a strong insight into further divergence between the two.
Modifications in the kernel
Android does not use the standard Linux kernel straightaway, but uses it with some enhancements. These include alarm driver, shared memory driver, inter-process communication interface, power management, low memory killer, kernel debugger and logger. Google has contributed all the kernel enhancements back to the open source community under GPL.
Bionic C library
The GNU C library used by most Linux distributions makes use of the Native POSIX Thread Library or NPTL, which offers high performance, especially in server applications. However, disk space footprint and memory requirements of NPTL are far too large for resource-limited systems such as mobile devices.
This led Google to create a new C library called Bionic. It has fast execution paths, avoids edge cases and remains a simple implementation. As mobile devices are single user systems, for security reasons Google has removed the settings for groups and passwords, keeping only a unique user id and group id. Bionic operates with the limited CPU and memory resources available on Android platforms.
The Dalvik Virtual Machine
Android uses a virtual machine to run applications. Most top cell manufacturers such as Samsung, Motorola and Nokia use J2ME, a mobile optimized version of the Java virtual machine. In contrast, Android uses the Dalvik Virtual Machine, which is a standard Java platform. The dex files used by Dalvik are more compact and optimized to perform well on mobile devices with slow CPUs, limited memory, no swap space and limited battery power.
File system
Most desktop/laptop/server applications use magnetic hard disks, which the standard Linux systems manage with the latest Ext journaling file system. However, magnetic drives are physically too large, too fragile and consume too much power. To provide a robust file system, embedded systems use solid-state memory devices such as NOR for code execution and NAND for storage. Block erasure and memory are important features of solid-state memory, which the Ext file system does not handle. Therefore, Android uses an optimized Linux flash file system called YAFFS and this deals with lifetime limitations, bad block management and error correction for maintaining data integrity in NAND flash systems.
Power management
Standard Linux systems manage power though APM or ACPI. Android does not use either, relying more on its own PowerManager module, which is a Linux power extension. The module has low-level drivers for controlling the peripheral supported such as screen display and backlight, keyboard backlight and button backlight.