What is Dalvik Virtual Machine?

An Android OS virtual machine.

Shivansh Kumar
2 min readFeb 20, 2023

Dalvik Virtual Machine (DVM) is a specialized virtual machine used by the Android operating system to execute applications written in Java. It is designed to be lightweight and optimized for mobile devices with limited resources, such as battery life and memory.

The DVM was named after a fishing village in Iceland, which was the hometown of the founder of the Android project, Andy Rubin. The DVM was the primary virtual machine used by Android until Android 5.0 Lollipop, which introduced the new Android Runtime (ART).

Here are some key features and components of the Dalvik Virtual Machine:

  • Bytecode format: The DVM executes code that is compiled into a specific bytecode format called “dex” (Dalvik Executable). This format is designed to be compact and optimized for the mobile environment. The dex format is created from the original Java bytecode using the dx tool, which is part of the Android SDK.
  • JIT compilation: The DVM uses a Just-In-Time (JIT) compiler to convert the dex bytecode into machine code at runtime. This process improves the performance of the application by reducing the overhead of interpreting the bytecode. The JIT compiler is used in the Android 2.2 Froyo and later versions.
  • Garbage collection: The DVM includes a garbage collector that automatically manages memory allocation and deallocation. This feature helps to prevent memory leaks and makes it easier for developers to write memory-efficient applications.
  • Class loading: The DVM uses a class loader to dynamically load classes and their associated resources. This allows applications to be updated and extended without requiring the user to reinstall the entire application.
  • Multiple virtual machines: The DVM allows multiple virtual machines to run simultaneously, which enables multiple applications to be executed concurrently. This feature allows for greater multitasking capabilities and improves the overall user experience.

Overall, the Dalvik Virtual Machine played a critical role in the early development of the Android operating system. Its lightweight design and optimized performance helped to make Android a popular mobile platform, and it laid the foundation for the newer Android Runtime (ART) that replaced it in later versions of the operating system.

--

--