The latest news and developments around Android, Google's embedded mobile platform featuring in smartphones, tablets, set-top boxes, cameras, watches and some other unexpected places...

What is… the Dalvik virtual machine?

android-dalvik-vm.jpgThe general underlying purpose of this blog is to help people (including me!) to get to better grips with the Android platform. In that spirit, let’s start a new series of posts that consider – in isolation – different parts of Android technology (terms and technologies that surface every now and then, but with their significance remaining somewhat submerged!)…

Which is a very round about way of saying ‘find out about things that sound important but about which I have no clue’!

First up is the “Dalvik virtual machine”, the open-source software originally created by one Dan Bornstein. This rather intimidating sounding phenomenon is the process virtual machine that runs in Google’s Android OS.  Basically, it houses the Apps running on your smartphone or tablet, or set-top box come to that.

Wikipedia neatly summarises it thus:

Android uses the Dalvik virtual machine with just-in-time compilation to run Dalvik bytecode, which is usually translated from Java bytecode. writes:

Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimised for minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the .dex format by the included “dx” tool.

Reflecting the Linux roots of Android’s design, separate user processes run – in the Dalvik VM – in relatively secure isolation from ‘core’ or kernel services, such as security, memory management, process management, and the network stack.

Here is what Google also has to say about .dex files:

Android programs are compiled into .dex (Dalvik Executable) files, which are in turn zipped into a single .apk file on the device. .dex files can be created by automatically translating compiled applications written in the Java programming language.

The Dalvik Debug Monitor Service (DDMS) is a key debugging utility that is integrated into the Eclipse IDE, the favoured development environment for Android apps.

Why ‘Dalvik’? Bornstein named it after the fishing village of Dalvík in Eyjafjörður, Iceland, according to Wikipedia, whether as somewhere his ancestors lived or just a favoured place…

Read a post by Dan Bornstein on the Dalvik JIT » (source of the pic at the top)

android-system-architecture.jpgYou can view a larger version of the Android Architecture Diagram that is thumbnailed right.

If you want a lot more detailed low-level information, check out the Dalvik bytecode, Dex file format, and instruction formats - see a complete spec for the format in the Dalvik git repository or on the Dalvik Docs Mirror.

Note that underlying details can change, so you should always check these source documents for definitive data.

Tags: dex files, Google, open source software, process management, virtual machine

Related posts