/DalviK Virtual Machine (DVM)

DalviK Virtual Machine (DVM)

Dalvik is the process virtual machine (VM) in Google’s Android operating system. It is the software that runs the apps on Android devices. a register-based architecture designed and written by Dan Bornstein with contributions from other Google engineers as part of the Android mobile phone platform.
Dalvik is thus an integral part of Android, which is typically used on mobile devices such as mobile phones and tablet computers. Programs are commonly written in a dialect of Java and compiled to bytecode.
then they are converted from Java Virtual Machine-compatible .class files to Dalvik-compatible .dex (Dalvik Executable) files before installation on a device.
The compact Dalvik Executable format is designed to be suitable for systems that are constrained in terms of memory and processor speed. It is optimized for low memory requirements, and is designed to allow multiple VM instances to run at once, relying on the underlying operating system for process isolation, memory management and threading support.
Dalvik is often referred to as a Java Virtual Machine, but this is not strictly accurate, as the bytecode on which it operates is not Java bytecode. Instead, a tool named dx, included in the Android SDK, transforms the Java Class files of Java classes compiled by a regular Java compiler into another class file format (the .dex format).
Dalvik does not align to Java SE nor Java ME class library , Instead it uses its own library built on a subset of the Apache Harmony Java implementation.
About Dex File Format .. 
Android programs are compiled into .dex (Dalvik Executable) files, which are in turn zipped into a single .apk (Android Package) file on the device.
.dex files can be created by automatically translating compiled applications written in the Java programming language.
    –Dex File Format
    –File Header
    –String Table
    –Class List
    –Field Table
    –Method Table
    –Class Definition Table
    –Field List
    –Method List
    –Code Header
    –Local Variable List
    
*File Header
Dex files start with a simple header with some checksums and offsets to other structures
*String Table
This table stores the length and offsets for every string in the Dex file including string constants, class names, variable names and more.
*Class List
A list of all classes referenced or conatined in this dex file
*Field Table
A table of fields of all classes defined in this dex file.
*Method Table
A table of methods of all classes defined in this dex file
*Class Definition Table
A table of class definitions for all classes either defined in this dex file or has a method or field accessed by code in this dex file.
*Field List
Stores data for pre-initialized fields in a class. The list is formed of a 32-bit integer containing the number of entries followed by the entries themselves.
*Method List
A list of methods for a particular class
*Code Header
This header contains information about the code that implements a method
*Local Variable List
A list of local variables for a particular method.
  
About Architecture ..
A tool called dx is used to convert some (but not all) Java .class files into the .dex format. Multiple classes are included in a single .dex file. Duplicate strings and other constants used in multiple class files are included only once in the .dex output to conserve space. Java bytecode is also converted into an alternative instruction set used by the Dalvik VM. An uncompressed .dex file is typically a few percent smaller in size than a compressed .jar (Java Archive) derived from the same .class files

About Performance .. 
Generally, stack-based machines must use instructions to load data on the stack and manipulate that data, and, thus, require more instructions than register machines to implement the same high level code, but the instructions in a register machine must encode the source and destination registers and, therefore, tend to be larger.
This difference is primarily of importance to VM interpreters for which opcode dispatch tends to be expensive along with other factors similarly relevant to just-in-time compilation.