Android Runtime 101: ART Component of Android Architecture

Basics of Android Runtime, Functions, and Envisioned Changes

Wakoli Votés
4 min readMar 3, 2023

Introduction

Android runtime forms part of the five components in the Android architecture. Others are System Applications, Application frameworks, Libraries, Hardware Abstraction Layer (HAL), and the Linux kernel.

Android Runtime (ART) and Dalvik rank as two good runtimes that have been part of the Android operating system (OS) since its inception. According to Google Developer, ART is the managed runtime used by applications and some system devices on Android, essential in executing the Dalvik Executable format and Dex bytecode specifications.

And as part of the Android architecture, ART has a Java Virtual Machine called Dalvik Virtual Machine (DVM), which is essential for running fundamental Linux features.

Using the DVM, it becomes possible for individual android applications to run independently using their specific DVM instances entirely.

Hence, irrespective of a particular application on the device, the DVM makes it possible to run them effectively without issues that can adversely affect runtimes due to the apps being on the same Android device.

Overview of Android Runtime (ART) and Dalvik Runtime

In programming, runtime denotes the period the program is running, from execution/opening to closed/quit, making it worthwhile to understand runtime environments (RTE) and virtual machines. ART and Dalvik are virtual machines essential in running Android applications.

First, Dalvik (Dex) bytecode represents the compiled code ( .dex files) from the standard Android compiled files ( .class files) before the application runs.

Overall, the dex files entail executable files saved in a format containing Android compiled code, i.e., “Dalvik Executable,” for execution by the virtual machine. Hence, both ART and Dalvik are runtimes that can effectively run Dex bytecode.

Modern Android devices and applications use the ART runtime instead of Dalvik Runtime.

Notably, Dalvik runtime was discontinued by the new adoption of ART and was used previously for running android devices before the onset of Android Lollipop (ver. 5.0 — 5.1.).

Image Source: Paulina Sadowska

The point below summarizes some aspects of Dalvik and ART:

  • Dalvik and ART are two different virtual machines used in the Android operating system for executing Android applications.
  • Dalvik was the original virtual machine used in Android before Android 5.0. It was designed to execute multiple virtual machine instances efficiently, using a just-in-time (JIT) compiler to optimize application performance at runtime. However, it had some limitations in terms of memory management and efficiency.
  • ART (Android RunTime) is the successor to Dalvik, introduced in Android 5.0. It uses an ahead-of-time (AOT) compiler to pre-compile applications before they are executed, allowing faster application startup times and better memory management. ART also includes additional features such as improved garbage collection and better support for debugging.
  • A critical difference between Dalvik and ART is their compilation strategy. Dalvik uses a JIT compiler, which compiles code as it is being executed. On the other hand, ART uses an AOT compiler, which pre-compiles code before it is executed, resulting in a faster performance at the cost of increased storage space.
  • Another difference is that ART provides better support for native code execution, which is helpful for applications that require high-performance computation. Additionally, ART offers improved security features such as runtime permission enforcement and better isolation of applications.
  • Overall, ART is a significant improvement over Dalvik in terms of performance, memory management, and security.

Android Runtime (ART) Significance Relative to Other Components

Android Runtime is only one of the five essential parts of Android architecture and plays a significant role in supplementing other components.

In the architecture shown in the Figure below, the runtime component comes after the Linux kernel and is intertwined between the Application Framework and Applications.

Hence, the Android runtime allows interconnectedness within the Android domain.

Similarly, the significance of ART arises from its primary purpose as a virtual machine (VM). Primarily, with the contained DVM, running multiple/different virtual machines (VMs) is possible, allowing various applications to run successfully.

Thus, rather than one application located in the “Applications” layer in the Android architecture, the Android runtime through the DVM makes running all applications possible.

Summary

In the mobile device domain, different operating systems (OS) exist. Android OS has become highly popular and widely used since its inception in 2007, and the initial release of Android 1.0 as on 23rd September 2008.

The initial and final working of Android devices relies on the performance and completion of the operation by the different parts that make up the Android architecture.

The Android architecture comprises four main sections, divided across five parts, playing a pivotal role in the Android OS.

These entail the Applications layer, Application framework layer, Android libraries, Android Runtime layer, and the Linux kernel. The Runtime (ART) forms an integral part of the Android architecture, pivotal in running Dex bytecode specifications.

ART (Android RunTime) is the current default virtual machine used in Android, starting from Android 5.0 (Lollipop) and later versions.

Dalvik was the original virtual machine used in Android before the release of Android 5.0. However, even though ART has replaced Dalvik as the default virtual machine, some older Android devices may still use Dalvik if they have not been updated to a newer version of Android.

--

--