Difference between revisions of "Android Dalvik VM"

From eLinux.org
Jump to: navigation, search
(add jit info, and fix some links)
Line 7: Line 7:
 
Dalvik was written so that a device can run multiple VMs efficiently. The Dalvik VM executes code in the Dalvik Executable (.dex) format which is optimized 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.
 
Dalvik was written so that a device can run multiple VMs efficiently. The Dalvik VM executes code in the Dalvik Executable (.dex) format which is optimized 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.
  
Most Android applications are presented to the system as packages, which include both dex bytes code (classes and methods) and resources.
+
Most Android applications are delivered and stored on the system as packages (.apks), which include both dex bytes code (classes and methods) and resources. During first boot-up (and subsequently during application install?) the system creates a cache of
 +
 
 +
== JIT ==
 +
As of version 2.2 (''Froyo''), Dalvik includes a JIT.
 +
 
 +
* See [http://code.google.com/events/io/2010/sessions/jit-compiler-androids-dalvik-vm.html A JIT Compiler for Android's Dalvik VM] - video of presentation by Ben Cheng and Bill Buzbee at Google IO, 2010
  
 
== Resources ==
 
== Resources ==
 
* [http://en.wikipedia.org/wiki/Dalvik_(software) Dalvik wikipedia entry]
 
* [http://en.wikipedia.org/wiki/Dalvik_(software) Dalvik wikipedia entry]
  
* [http://sites.google.com/site/io/dalvik-vm-internals Presentation from Google I/O 2008 on Dalvik VM] by Dan Bornstein
+
* [http://sites.google.com/site/io/dalvik-vm-internals Dalvik VM Internals] - video of presentation by Dan Bornstein at Google IO, 2008
  
 
* [http://www.retrodev.com/android/dexformat.html DEX file format], reverse engineered by Michael Pavone
 
* [http://www.retrodev.com/android/dexformat.html DEX file format], reverse engineered by Michael Pavone
 
   
 
   
 
* [http://developer.android.com/reference/dalvik/bytecode/Opcodes.html Dalvik bytecodes]
 
* [http://developer.android.com/reference/dalvik/bytecode/Opcodes.html Dalvik bytecodes]

Revision as of 20:13, 15 July 2010

Dalvik is the name of the Virtual Machine in which Android applications are run. This VM executes Dalvik bytecode, which is compiled from programs written in the Java language. Note that the Dalvik VM is not a Java VM (JVM).

Every Android application runs in its own process, with its own instance of the Dalvik virtual machine.

At boot time, a single virtual machine, called 'zygote' is created, which preloads a long list of classes. (As of Android version 2.1 (eclair), the list of classes preloaded by zygote had 1,942 entries). All other "java" programs or services are forked from this process, and run as their own process (and threads) in their own address space. Both applications and system services in the Android framework are implemented in "java".

Dalvik was written so that a device can run multiple VMs efficiently. The Dalvik VM executes code in the Dalvik Executable (.dex) format which is optimized 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.

Most Android applications are delivered and stored on the system as packages (.apks), which include both dex bytes code (classes and methods) and resources. During first boot-up (and subsequently during application install?) the system creates a cache of

JIT

As of version 2.2 (Froyo), Dalvik includes a JIT.

Resources