Part of Android's architecture is called Android Runtime, the Android runtime environment, which includes two parts, one core class library for Android, and one Dalvik virtual machine.
The reason why Android develops Dalvik virtual machines without using Java's own JVM is due to the following two considerations (personally, it does not mean broad sense):
1. Copyright issues, if the use of the JVM involves copyright issues, so Google needs to make some improvements on the basis of the JVM, to create their own virtual machines.
2. Performance issues. Of course, the JVM virtual machine for Java development performance is enough, but relative to the characteristics of mobile platform, such as low memory, low power, and so on, it seems a bit far-fetched, so in order to optimize the efficiency of virtual machines, Google developed Android own virtual machine.
As shown, the JVM is. Java text is compiled into a. Class bytecode file, and the class loader loads all the required classes into memory when executing Java programs.
Shows the structure of loading bytecode files into memory, each class file is parsed into several parts, including the header (mainly JDK version, etc.), constants, etc...
How many classes, in memory, will produce the files in the structure.
Shown is the class file structure of the Dalvik virtual machine load. The Davik virtual machine compiles the. java file into a. class file, and then converts the. class file to a. dex file, Dalvik to execute the. dex file.
In fact, a. dex file is a combination of constants, methods, and so on in multiple class files. form the structure as shown.
On the schema, the JVM is a stack-based architecture, so each access to the data CPU takes data into memory.
The Dalvik is a register-based architecture. Registers are a chunk of storage on the CPU, and the CPU is much faster if it reads data directly from the registers.