Under the Hood

The Android Operating System

A brief look inside the most popular operating system in history

Atif Khurshid
6 min readNov 12, 2020

Android is an open-source mobile operating system built on top of a modified version of the Linux kernel. It is developed by the Open Handset Alliance, a consortium of technology industry giants led by Google. It is licensed under the Apache License and its source code is released as part of the Android Open Source Project (AOSP). Launched in 2007, Android soon become the best-selling operating system in history because of its open development model and user-friendly interface. Its latest version, Android 11, was released in 2020.

History

The Android Inc. startup was founded in 2003 with the goal of developing smart mobile devices. It began with the development of an operating system for digital cameras but the focus soon shifted to mobile phones because of their larger market size. The project was acquired by Google in 2005.

In 2007, Google joined with several hardware manufacturers and wireless carriers to form the Open Handset Alliance with the goal of developing an open-source platform for mobile devices. At the time, all mobile phones were limited to the manufacturers’ ecosystems with little room for third-party applications. The alliance claimed that an open platform would allow for collaboration between manufacturers and developers to facilitate rapid and cheap production of innovative products and applications.

The Android platform was revealed in 2007 and made available commercially the next year. At first, the platform was hindered by its limited feature set and small user base compared to rivals Symbian and Windows. Its upgradability, however, became its greatest asset as each new update brought new features alongside performance enhancements. Early versions were named after desserts in alphabetic order like Cupcake, Jellybean and KitKat because of “the sweetness they bring to our lives”. Google soon ran out of desserts, however, and chose to brand new versions with numbers starting with Android 10 in 2019. Its open-source license also helped to increase its popularity with the device manufacturers as they could modify the operating system to suit their needs without affecting application development.

Most importantly, however, Android was more than just an operating system. It was a platform which brought mobile devices on equal terms with personal computers by allowing developers to write applications independent of the device hardware. This led to the creation of a global application ecosystem and solidified Android’s position as the foremost mobile platform. It became the best-selling operating system on smartphones in 2011 and tablets in 2013. Today, Android can be found on a range of electronic devices including smart cameras, watches, media players and many more.

Architecture

Android was originally developed for the ARM architecture and later expanded to support x86 and x86–64 architectures. In general, however, Android does not concern itself with the device hardware because of the variability in the number and types of components in mobile devices.

Android Platform Architecture
Source: https://developer.android.com/guide/platform

At the heart of the Android operating system lies a modified version of a Linux LTS kernel that interacts directly with the hardware. The drivers essential to device operation are implemented by hardware manufacturers and added to the kernel. This allows hardware manufacturers to develop drivers for a well-known kernel and operating system developers to ignore hardware variability. Android 11 supports kernel versions 4.14, 4.19 and 5.4.

Hardware complexities are further concealed by hardware abstraction layers, also implemented by manufacturers, which provide standard interfaces for the higher-level frameworks to access device hardware without being concerned about driver implementations.

Android Runtime is the virtual machine that executes application code contained in Dalvik Executable (DEX) files. It manages code compilation, debugging, and garbage collection. Each application runs with its own instance of ART, i.e. in its own virtual machine, to ensure code isolation. ART replaced Dalvik as Android’s Java virtual machine in 2013 as its Ahead-of-Time compilation provided improved performance over the latter’s Just-in-Time compilation.

Native C/C++ libraries are an essential part of the operating system as most core Android components are written in native code. The Java API framework is the gateway to the operating system for all user applications. It provides many services to applications in the form of Java API calls including the Activity, Resource and Notification managers, Content providers and the View system. This is why Android applications are mainly developed in Java, although the native libraries do provide some support for C/C++. More recently, Kotlin has also been supported, and even preferred by Google, for Android application development. The code is compiled by the Android Software Development Kit (SDK) and archived as an Android package (APK).

Android vs Linux

Although Android is considered by some to be a Linux distribution, it has little in common with a conventional Linux operating system.

Traditional Linux Stack. Source: https://cumulusnetworks.com/blog/linux-architecture/
Source: https://cumulusnetworks.com/blog/linux-architecture/

In a traditional Linux stack, the kernel performs most system functions such as memory and file management, hardware interaction and process scheduling. System features are provided to applications though libraries and API calls in the C Language. This is why GNU C is the more important library in Linux. Users interact with the system through shells which translate user commands into system calls.

Android, on the other hand, can be considered as a user application running on Linux. It uses the kernel for hardware interactions and system management, and then offers its features to other applications through an API interface. This interface is entirely in Java and even the features of the C/C++ libraries are offered in Java wrappers. Android does not include a shell, although some command-line utilities are supported through the Toybox application.

Android has also been optimized for mobile devices which typically have low processing power, small memory and are battery-operated. It uses Bionic instead of GNU as the default C Library because of its smaller memory and processor requirements. It can kill least recently used processes and discard shared memory units under out of memory conditions. It also implements a unique power management system where the device remains idle, drawing minimal power, unless a resource is requested by a process.

Android Kernel

Android Kernel Hierarchy. Source: https://source.android.com/devices/architecture/kernel/generic-kernel-image
Source: https://source.android.com/devices/architecture/kernel/generic-kernel-image

The Linux kernel itself is modified by several parties before it is installed on a device. Firstly, Android developers optimize the LTS kernel for mobile devices, patch in Android features and release the code as the AOSP common kernel. AOSP developers implement most changes as device drivers to ensures that minimal changes are made to the core kernel code. This allows base kernel updates to be merged to ACK with minimal changes. Hardware vendors add drivers and abstraction layers to generate a vendor kernel. Then, device manufacturers update the kernel according to their requirements by implementing new drivers or even system improvements. This kernel is finally installed on the manufacturers’ devices.

Application Development

Android’s design philosophy is to abstract away hardware variabilities and to provide a uniform interface for applications. This is accomplished by running all applications in java virtual machines likes Dalvik or ART. The application development kit, consisting of Java API framework and Android SDK, further promote this abstraction by making application development easier. The API interface does all the heavy lifting to allow applications to access system resources with just a function call while the SDK provides visual tools to create application layouts and manage user inputs.

Android provides most of its features to applications through services. A service is an application that performs long-running operations in the background. It does not provide a user interface and can only be accessed through the API framework. Services can also perform operations in the foreground and notify the user through notifications. A service can also be bound to an application and provide a client-server interface.

The Android stack also includes a second operating system. The Trusty OS runs in parallel with the main operating system and provides a Trusted Execution Environment for isolated execution. It is mainly used for mobile payment, secure banking, password processing and other processes that require security and confidentiality.

Conclusion

When the Open Handset Alliance was first announced, their plans of a collaborative effort to develop an open and comprehensive platform sounded little more than a boisterous claim. A decade onwards, however, the Android framework has accomplished to revolutionize a deal more than just the mobile industry. It has, in fact, given rise to entirely new industries and fundamentally changed the way we communicate, work and live.

--

--