What is the difference between JVM, DVM, KVM and ART?

Published on Author Code Father
What is the difference between JVM, DVM, KVM and ART? JVM vs DVM

Conceptually, there is little difference from an application level between a DVM and a JVM. Architecturally, there is a major difference between the register based DVM and the stack-based JVM. Both use a VM code model. However, the DVM uses register based opcodes that are comparable to the register-based bytecode instructions that most of the target platforms already execute. This includes architectures such as those available from ARM and MIPS and the x86-compatible architectures from Intel, AMD, and VIA Technologies. Google developed Android and chose DVM for several reasons. First, there were licensing issues with most JVMs. Next, the DVM should be more efficient in terms of memory usage and performance on a register-based machine. DVM is also supposed to be more efficient when running multiple instances of the DVM. Applications are given their own instance. Hence, multiple active applications require multiple DVM instances. Like most Java implementations, the DVM has an automatic garbage collector. 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. The KVM is specifically optimized for use with devices with 128k – 256k available memory. It is developed for use with J2ME. The JVM has additional libraries and functionality that the KVM does not have out of the box (but these libraries can be added to the KVM as needed).\] ART (Android Runtime) is a replacement for Dalvik that uses Ahead-Of-Time (AOT) compilation, meaning your apps are compiled to a ready-to-run state before you even launch them. This is usually done, at the time of app installation, making the process of launching and using them much faster and smoother. And since this means that compilation is only done once, you may also see better battery life, too.