MAD - Lecture notes 1 PDF

Title MAD - Lecture notes 1
Author Faheem Bakhtar
Course Mobile Application Development
Institution Capital University of Science and Technology
Pages 5
File Size 257.3 KB
File Type PDF
Total Downloads 46
Total Views 167

Summary

Differences between JVM and DVM...


Description

MOBILE APPLICATION DEVELOPMENT Faheem Raza BCS181029

SUBMITTED TO SIR SAAD ILYAS

Qno1: What is JVM and DVM?

JVM: A Java virtual machine (JVM) is an abstract layer between the Java program and the platform the Java code is running on. JVM is platform dependent and different implementations are available for specific platforms.

DVM: A Dalvik Virtual Machine (DVM) is a virtual machine which executes the android applications. Since everything in mobiles is very limited whether it would be a battery life, processing and memory etc. It had been optimized so that it can fit in with low-powered devices. As you can see from the image above, everything is same as JVM except the last two steps. 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.

Qno2: Why Android Uses DVM? 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. JVM was designed for desktops and it is too heavy for embedded devices. DVM takes less memory, runs and loads faster compared to JVM. That’s why android uses DVM instead of JVM.

Qno3: Explain the DVM in detail? A Dalvik Virtual Machine (DVM) is a virtual machine which executes the android applications. Since everything in mobiles is very limited whether it would be a battery life, processing and memory etc. It had been optimized so that it can fit in with low-powered devices. The Role of the DVM in Android includes:   

Optimizing the Virtual Machine for memory, battery life, and performance Conversion of class files into .dex file through Dex compiler that runs on Dalvik VM. Converting multiple class files into dex files.

The Dex compiler helps convert the class file into .dex file, the following image shows how it flows:

 

First of all, the .java file converts into .class file with the help of Java compiler. Next .class file converts into .dex file using Dec compiler.

Then finally the packaging process is handled by the Android Assets packaging tools (aapt). Advantages  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. Disadvantages  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. 

Qno4: What are the differences between JVM and DVM? DVM Register based which is designed to run on low memory. Use byte code and runs in .dex file. Device can run multiple instances of DVM efficiently. Support only Android OS. Applications are given their own instance Constant Pool for every application. Executable is APK

JVM Stack based. Uses byte code and runs .class file Single instance of JVM is shared with multiple application Supports multiple OS. JVM has many re-tools available. Constant Pool for every class. Executable is JAR.

References: https://www.cwipedia.in/2020/09/difference-between-jvm-and-dvm.html https://towardsdatascience.com/jvm-vs-dvm-b257229d18a2#:~:text=One%20of%20the %20main%20reasons,and%20also%20slower%20than%20DVM. https://data-flair.training/blogs/android-dalvik-virtual-machine/

https://www.geeksforgeeks.org/what-is-dvmdalvik-virtual-machine/ https://www.guru99.com/java-virtual-machine-jvm.html#:~:text=Java%20Virtual %20Machine%20(JVM)%20is,code%20for%20a%20particular%20system....


Similar Free PDFs