According to THEINTERNETFAQS, the DalvikVM is a virtual machine developed by Google for Android. Your task as a Java Virtual Machine is to translate a Java-based app from bytecode into machine-readable code in real time.
DalvikVM: Overview and general information about the virtual machine
The Google employee Dan Bornstein, who named the virtual machine after the Icelandic city of Dalvík, was responsible for the development of DalvikVM. You can often read that Bornstein’s ancestors came from this city, but this is an urban legend. He chose the name only out of love for Dalvík as a vacation spot.
DalvikVM is a Java virtual machine for mobile devices that is a core component of Google’s Android platform. A distinguishing feature from the majority of other Java Virtual Machines is Dalvik’s operation as a registration machine. Most of the other JVMs are based on what are known as push-down automata. DalvikVM also has its own bytecode .
Basically, the virtual machine has been developed in such a way that it can run different instances equally efficiently on one device. Just like modern processors, the DalvikVM can process register machine code. Therefore, the virtual machine acts as quickly as it is resource-saving. This is also necessary because each program runs in its own process with the Android operating system and works with its own DalvikVM or generates one.
As an alternative runtime environment, Android has been offering an alternative register machine in the form of ART (Android Runtime) since version 4.4 (KitKat). DalvikVM relies on just-in-time compilation.
Functionality and components
DalvikVM can be understood as an intermediate step that stands between the source code and the procedurally executable code. As part of just-in-time compilation, the source code is translated at runtime.
First, DalvikVM runs the software translated for JVM after the conversion in its own bytecode. The dx program plays an important role here. This is an essential part of the Android development environment. The dx program is responsible for converting regular .class files (Java binary files) into the .dex (Dalvik Executable Format) format. Several .class files are combined into one .dex file.
Furthermore, optimizations are made with regard to the storage requirements. For the execution of each app, the files are started in .dex format. Before Dalvik translates the app for the processor, the source code is translated into bytecode. DalvikVM then translates this into machine-readable code. Then the processor executes this code.
Sandbox: separate instances for all processes
An integral part of how the Dalvik Virtual Machine works is sandbox technology. The application runs in an isolated environment, a so-called sandbox. In practice, this means that there is a separate instance for each process. This ensures that each instance is independent of other instances. One instance cannot influence the other instances either.
The isolated environment also prevents the DalvikVM program from performing direct operations on the operating system or hardware. Accidental switching off of the device or access and manipulation of memory or applications is thus excluded.
Nevertheless, every app needs a certain amount of access to the hardware of a device, for example to the memory or the display. Since no application would function without such access authorizations, the virtual machine provides some functions via special interfaces (APIs).
Via APIs ( Application Programming Interfaces ), the programmer receives specifically defined function calls or methods that the app might need. Through and through the APIs it is ensured that an application can receive access authorization to different resources of the operating system.
With each new version of Android or with each new API level, these APIs are expanded or changed. The respective API level provides a rough indication of the current software version of the Android operating system. Compatibility with older versions can be derived from this.
Due to these adjustments, it can happen that certain apps can no longer be used with older versions. Some apps use the methods of a newer Android version and may no longer be compatible with older versions. For example, Bluetooth functions can only be used from API level 5 (from Android 2.0).
An important functional area is the management of authorizations. These are directly linked to the aforementioned API operations. In principle, users can decide whether they actually want to install the app in view of the required permissions.
Certain API operations can read files (for example phone book entries or browser histories) or influence the functionality. Others are at the expense of battery performance (e.g. Bluetooth or camera). There are also operations that are associated with costs for the user (for example online use). Therefore, such operations can only be achieved through authorizations. The user is informed of these authorizations during installation .