Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between DVM and JVM?

What is difference between Java Virtual Machine and Dalvik Virtual Machine?

like image 267
anish Avatar asked Aug 10 '10 06:08

anish


People also ask

Why DVM is used instead of JVM?

One of the main reasons of using DVM in android is because it follows the register based model and it is much faster than stack based model while JVM follows the stack based model which takes a lot of memory and also slower than DVM.

Is DVM stack based?

It is Stack based. JVM uses java byte code and runs “. class” file having JIT (Just In Time). DVM has been designed so that a device can run multiple instances of the VM efficiently.

What is difference between JVM and interpreter?

Simply put, a JVM interprets bytecode and a Java interpreter interprets Java. They are different because bytecode and Java are different languages. Bytecode is a low-level language, like machine code. The bytecode is meant to be run by a program called a bytecode interpreter, also called a virtual machine.

What is the difference between JVM and CLR?

The CLR allows user code to define new value types (structs), whereas the JVM provides a fixed collection of value types (byte, short, int, long, float, double, char, boolean) and only allows users to define new reference-types (classes). The CLR provides support for declaring and manipulating pointers.


1 Answers

DVM is Register based which is designed to run on low memory, uses its own byte code and runs .Dex file

JVM is Stack based which uses java byte code and runs .class file having JIT.

Java source code is compiled by the Java compiler into .class files. Then the dx (dexer) tool, part of the Android SDK processes the .class files into a file format called DEX that contains Dalvik bytecode. The dx tool eliminate all the redundant information that is present in the classes. In DEX all the classes of the application are packed into one file. DVM has been designed so that a device can run multiple instances of the VM efficiently.

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.

like image 108
Mayuri Avatar answered Oct 13 '22 07:10

Mayuri