Dalvik Virtual Machine is a Register-Based virtual machine. It was designed and written by Dan Bornstein with contributions of other Google engineers as part of the Android mobile phone platform. The Dalvik virtual machine was named after Bornstein after the fishing village “Dalvík” in Eyjafjörður, Iceland, where some of his ancestors used to live.
Working of DVM
The Java Compiler(javac) converts the Java Source Code into Java Byte-Code(.class). Then DEX Compiler converts this (.class) file into in Dalvik Byte Code i.e. “.dex” file.
For Android, a new Virtual machine was developed by Google as stated above. It uses registers of the CPU to store the operands. So no requirement of any pushing and popping of instructions. Hence making execution faster. The instructions operate on virtual registers, being those virtual registers memory positions in the host device. Register-based models are good at optimizing and running on low memory. They can store common sub-expression results which can be used again in the future. This is not possible in a Stack-based model at all. Dalvik Virtual Machine uses its own byte-code and runs “.dex”(Dalvik Executable File) file.
- DVM supports the Android operating system only.
- In DVM executable is APK.
- Execution is faster.
- From Android 2.2 SDK Dalvik has it’s own JIT (Just In Time) compiler.
- DVM has been designed so that a device can run multiple instances of the Virtual Machine effectively.
- Applications are given their own instances.
- DVM supports only Android Operating System.
- For DVM very few Re-Tools are available.
- Requires more instructions than register machines to implement the same high-level code.
- App Installation takes more time due to dex.
- More internal storage is required.