Adriod--dvm

Source: Internet
Author: User

Android DVM  the Android operating environment mainly refers to the virtual machine technology--dalvik. All Java programs in Android are running on Dalvik VMs. Every program on Android has its own thread, and DVM executes only. Dex's Dalvik executable file.    Each Android application should have an independent DVM instance on the ground floor and be executed under its interpretation.
Although DVM is also in the Java programming language, Dalvik virtual machines and generic Java virtual machines (Java VMS) are not compatible, the difference between the two is that the JVM standard executes the. class bytecode (bytecode), but the DVM executes its proprietary (. Dex) Execute the file. During compilation, Java compiles the class into one or more. Class byte code files, which are then packaged into jars where the JVM obtains the corresponding. class file and JRE bytecode from the jar file.    Although the Android VM is also programmed in the Java language, after compiling the Java program, it needs to be converted into. dex format by the Dex tool in the SDK, where the DVM reads the instructions and data.
Each application is a process (one of the Linux processes). The biggest difference is that the Java VM is a stack-based virtual machine (stack-based), and Dalvik is a register-based virtual machine (register-based).     Obviously, the latter's greatest benefit is that it can be optimized for hardware, which is better suited to the characteristics of mobile devices.
The DVM is ideal for use on mobile terminals, and it does not require a fast CPU and a lot of memory space compared to a PC. Google's calculations show that 64MB of memory has allowed the system to function properly. Where 24MB is used for initialization and startup of the underlying system. Another 20MB is used to start high-level services. A DVM has the following characteristics:
• Use the proprietary. Dex format.

• The reason is that after compiling the Java class file, at least one. class file contains a large amount of Chen Yu information, and the Dex file format consolidates all the. class file contents into a. dex file. This reduces the overall file size and IO operations, but also improves the class lookup speed.

• Added support for new opcode

• The file structure is as concise as possible, using equal-length instructions to improve parsing speed.

• Maximize the size of the read-only structure to improve data sharing across processes.

dex optimization, the Dex file structure is compact, but if you want to improve the performance of the runtime, you need to further optimize the Dex files, these optimizations for the following aspects:

• Verify all classes in the Dex file

• Optimization of operation codes within specific classes and methods
• Adjust all byte-order (Little_endian) and align each domain in the structure
• Registers-based virtual machines are less versatile than stack-based virtual machines in hardware, but their code execution efficiency is even better
• Each Android app runs in its own DVM instance, each of which is a separate process space. All Android apps have threads that correspond to a Linux thread, and the DVM can therefore rely more on the operating system's thread scheduling and management mechanisms. Different applications run in different process spaces, and different applications are run with different Linux users to maximize the security and independence of the insured application http://blog.csdn.net/virus026/archive/2010/12/19/ 6085779.aspx

Adriod--dvm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.