Q-1 What is the role of DVM in android? Explain it.
- The Dalvik Virtual Machine (DVM) is an android virtual machine optimized for mobile devices.
- It optimizes the virtual machine for memory, battery life and performance.
- The Dex compiler converts the class files into the .dex file that run on the Dalvik VM.
- Multiple class files are converted into one dex file.
- The javac tool compiles the java source file into the class file.
- The dx tool takes all the class files of your application and generates a single .dex file.
- It is a platform-specific tool.
- The Android Assets Packaging Tool (aapt) handles the packaging process.
Dalvik virtual machine uses register based architecture. With this architecture, Dalvik Virtual Machine has few advantages over JAVA virtual machine such as:
- Dalvik uses its own 16 bit instruction set than java 8 bit stack instructions, which reduce the dalvik instruction count and raised its interpreter speed.
- Dalvik use less space, which means an uncompressed .dex file is smaller in size(few bytes) than compressed java archive file(.jar file).