Difference of DVM and JVM in the Android World

Posted by By Bhavya Siddappa at 10 December, at 08 : 15 AM Print

http://www.momob.in/wp-content/plugins/sociofluid/images/digg_32.png http://www.momob.in/wp-content/plugins/sociofluid/images/reddit_32.png http://www.momob.in/wp-content/plugins/sociofluid/images/stumbleupon_32.png http://www.momob.in/wp-content/plugins/sociofluid/images/delicious_32.png http://www.momob.in/wp-content/plugins/sociofluid/images/google_32.png http://www.momob.in/wp-content/plugins/sociofluid/images/myspace_32.png http://www.momob.in/wp-content/plugins/sociofluid/images/facebook_32.png http://www.momob.in/wp-content/plugins/sociofluid/images/twitter_32.png

Dalvik Virtual machine (DVM) is Register Architecture, designed to run on low memory, uses its own byte code and runs .Dex file (Dalvik Executable File)

Java Virtual Machine (JVM) is Stack Architecture, 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 proprietary file format called DEX that contains Dalvik bytecode.

Difference between .class and .dex file format

● In DEX all the classes of the application are packed into one file.

● All the classes in the same DEX file share field, method, etc if they are same.

● Classes from the same DEX file are loaded by the same class loader instance.

Click on the link below to view in graphic the difference between the two:

Difference between .class and .dex file

The dx tool eliminate all the redundant information that is present in the classes. The initial loading and parsing procedures that happens again and again are eliminated.

In general, a Java .class file contains a number of different method signatures used in the code. These signatures are duplicated if referenced in different Java classes.In other words, each of these classes references to the methods that takes the same arguments and the same return type. So, each one of these classes will have to include the same method signatures and hence the efforts of parsing the files are duplicated. In addition to this, there is a large number of strings included that labels the internal bits of the class files.

In the dex conversion all of the separate constant pools are collapsed into a single shared constant pool. This way not only is redundant information eliminated but storage space to store the shared constant pool is also conserved.

General Tech , ,

Related Posts

One Comment

  1. Nikhil, 2 years ago

    All the additional features bragged by dalvik such as sharing of constant pools, removing redundancy (referred to as romization) have been present in JVM for ages. It’s just they never marketed themselves properly. In fact the open source code is also available in the form of Sun’s PhoneME.

    You might want to share some information about Romization in Sun’s VM here.


Editorial team:


Chief Editor and President of momo Bangalore
Setlur Raghavan Raja

Editors
Kesava Reddy M
Thiyagarajan M