Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Difference Between JVM and DVM

  • Last Updated : 29 Dec, 2020

JVM is the virtual machine that runs java code on different platforms. It acts as an abstract layer between the program and the platform on which the java code is running. The portability of Java code is possible only because of the JVM. The javac compiler converts the source code file(.java file) into an intermediate java bytecode format which is machine/platform independent. This intermediate file is then provided to the target machine/platform where it gets translated into machine code. JVM supports multiple host architecture and it is the reason why Java applications are called WORA(Write Once Run Anywhere).

JVM(Java Virtual Machine)

DVM(Dalvik Virtual Machine)

DVM is a virtual machine to execute Android applications. The Java bytecode(.class file) generated by javac compiler is converted into Dalvik bytecode to make the application source files executable on the DVM. Since Android devices have a definite processing capacity, memory, and battery life, the DVM design principle aims to optimize itself so that it can load fastly and run smoothly even on low memory/powered devices. This virtual machine is very efficient in running multiple instances on the same device.

DVM(Dalvik Virtual Machine)

Difference Table

JVM(Java Virtual Machine)

DVM(Dalvik Virtual Machine)

Stack-based VM that performs arithmetic and logic operations through push and pop operands. The result of operations is stored in stack memory.Register-based VM that uses registers located in the CPU to perform arithmetic and logic operations.
Java source code is compiled into Java bytecode format(.class file) that further translates into machine code.Source code files are first of all compiled into Java bytecode format like JVM. Further, the DEX compiler(dx tool) converts the Java bytecode into Dalvik bytecode(classes.dex) file that will be used to create the .apk file.
More information is required to the VM for data loading and manipulation as well as method loading in the stack data structure.Instruction size is larger as it needs to encode the source and destination register of the VM.
Compiled bytecode size is compact because the location of the operand is implicitly on the operand stack.Compiled bytecode size is larger as each instruction needs all implicit operands.
The executable file for the device is .jar file.The executable file for the device is .apk file.
A single instance of JVM is configured with shared processes and memory space in order to run all deployed applications.The device runs multiple DVM instances with a separate process in shared memory space to deploy the code of each application. 
Supports multiple operating systems like Linux, Windows, and Mac OS.Support only the Android operation system.

Note: Google introduced a new Virtual machine for android applications in 2014 which is known as Android Runtime(ART). It is designed with the purpose to improve application performance and reduce device battery usage. The last supported version for the DVM was Android 4.4(Kitkat).

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!