May 19, 2012

Java Virtual Machine (JVM) vs Kilobyte Virtual Machine (KVM) vs Dalvik Virtual Machine (DVM)

Hi friends,

Do you that the java program, when running on different architectures, it runs on different virtual machine (VM)?

Why it need different VM when running the similar syntactical code?

Let me take the opportunity to share and explain what I have gone through

I have been read about 3 main VMs.

Java Virtual Machine
Kilobyte Virtual Machine
Dalvik Virtual Machine

Java Virtual Machine:
JVM executes Java .class bytecode to run the Java applications. JVM with set of libraries form a JRE, which is installed on computer to execute any Java program.


Kilobyte Virtual Machine:
Java API contains large set of standard libraries. To use the same no.of libraries in Mobile is not possible due to memory constraint in the mobile. So, they have come up with an idea to take a subset of libraries and form a profile in Java 2 Platform Micro Edition (J2ME). So JVM is replaced with less memory running KVM. KVM is designed to run in kilobytes memory for small devices.

Dalvik Virtual Machine:
When it comes to Android Operating System, they don't want to either JVM or KVM. Because they want to run a virtual machine for every application. This concept can't be implemented with existing virtual machines. Due to this reason, this virtual machine is integral part of the Android Operating System. In Android, the java .class bytecode converted to dalvik compatible .dex which will be executed with Dalvik Virtual Machine (DVM). The set of .dex files forms an Android Package (.apk) file, which gets installed on the devices to install and run the applications.

Similarities:
All the virtual machines primary source is developed in java.

Dissimilarities:
Set of libraries have changed.
Memory allocation is different.


References:
http://docs.oracle.com/javase/specs/jvms/se7/html/index.html
http://java.sun.com/products/cldc/wp/
http://catazinelive.catreloaded.net/2012/02/08/dvm-dalvik-virtual-machine/

No comments:

Featured Post

Java Introdcution

Please send your review and feedback to psrdotcom@gmail.com