Open In App

What is DVM(Dalvik Virtual Machine)?

Last Updated : 25 Oct, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Dalvik Virtual Machine Register Based VM The language is designed by Dan Bornstein, some cool features and nature of Apple Swift iOS Programming Language he gave it a try with the initial compiler implementations examples contributed from other Google engineers at its Android mobile phone platform. The Dalvik virtual machine was named in that way after Bornstein, a resident of the nearby village "Dalvík", born on ''Eyjafjörður''.

What is Dalvik Virtual Machine?

Dalvik Virtual Machine (DVM) is the custom program introduced for Android apps. It takes the Java code and creates an optimized version of it in a file with .dex(extension) which is known as Dalvik executable. This format allows the apps to run quickly with fewer resources, i.e. on mobile phones and low-memory, slower devices. This is different from a typical Java Virtual Machine (JVM), as it optimized especially for Android to run apps that use less memory and are compatible with the millions of devices running on various versions.

DVM(Dalvik Virtual Machine)

Simple Working of DVM

Working of DVM

Java Source Code

  • The original development of Android apps is mostly done using Java programming language that developers use to write the instructions your app executes.

Compilation

  • We need to convert this textual Java code into form understandable by computer. This is commonly referred to as compilation. This Java bytecode is an executable version of your code.

Conversion to Dalvik Bytecode

  • The Java bytecode is transformed into a different format known as Dalvik byte code. They use a tool called dx, to do this and make the code run smoothly on Android devices.

Dalvik Virtual Machine (DVM)

  • Last, but not least the Dalvik bytecode is run on the Dalvik Virtual Machine (DVM). DVM has the special ability to run the applications on mobile devices which have limited capabilities of memory and battery.

Features of Dalvik Virtual Machine

  • Register-Based Architecture: Dalvik is a register-based virtual machine unlike the traditional stack based one (like JVM). This helps minimize overhead that would be incurred by constantly pushing and popping values off the stack making execution faster, especially on low memory mobile devices.
  • Optimized for Mobile Devices: It is an optimizing BSJ virtual machine that was designed specifically to run on the Android operating system, with low memory and power requirements. It virtualizes multiple apps by running a separate instance of the VM for each application as it does best in simultaneously handling many applications.
  • Dex Bytecode Execution: Dalvik uses. dex (Dalvik Executable) files—these compile the source into a more compact bytecode in order to make it better-suited for low-memory environments. We compile multiple Java classes into a single. dex file so that it was just 63% of the original size, meaning a small parse and load time on mobile devices.
  • Just In Time (JIT) Compilation: Dalvik was released from Android 2.2 (Froyo) and later included a JIT compiler to translate the bytecode into machine code directly at execution runtime, which could eventually boost frequently executed codes performance.
  • Garbage Collection: The above code ran on the DALVIK which has automatic garbage collection to make sure that apps will not consume large amount of resources and thus there is no effect in system stability.
  • Support for Multithreading: Dalvik is multithreading mobile machine can have multiple threads at the same time for an application to work on. This feature is one of the most required things when it comes to mobile apps e.g., background process along with foreground user tracking.

Advantages of DVM(Dalvik Virtual Machine)

  • 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.
  • Applications are given their own instances.

Disadvantages of DVM(Dalvik Virtual Machine)

  • DVM supports only Android Operating System.
  • For DVM very few Re-Tools are available.
  • App Installation takes more time due to dex.
  • More internal storage is required.

Application of Dalvik Virtual Machine

  • Running Android Apps: It improves how apps run by using processing power and less memory, ensuring smooth work.
  • Support for Multitasking: It allows multiple android apps to run at the same time without interrupting each other sped , making multi tasking smoother on mobile devices.
  • Memory Management: It manages memory more efficiently than older system, making sure that apps can run well even on devices with limited memory.

Conclusion

The Dalvik Virtual Machine was essential for the early Android phones. DVM is very handy to build an android apps because it could be optimized for mobile, take care of low-memory & handling the multiple app. In more recent Android versions, DVM has been replaced by ART but it paved the road on how apps get executed in an Android system.


Next Article
Article Tags :

Similar Reads