Android Virtual machine learning Summary Dalvik virtual machine process and thread creation process analysis

Source: Internet
Author: User

Dalvik virtual machine when calling a member function, if it is found that the member function is a JNI method, then it will jump to its address directly to execute. In other words, the JNI method is executed directly on the local operating system, not by the Dalvik virtual machine interpreter. It can also be seen that the JNI approach is a means for the Android application to communicate directly with the local operating system.


Dalvik virtual machines can execute native code, which is a C + + function, in addition to Java code execution. In the process of execution, these C + + functions can also be used to create local operating system processes or threads, that is, Linux processes and threads, through the system-provided by the local operating system. If the process created in the native code is loaded with a Dalvik virtual machine, it can actually be seen as a Dalvik virtual machine process. On the other hand, if a thread created in the native code can execute Java code, it can actually be seen as a Dalvik virtual machine thread.

I. Dalvik virtual machine process creation process

the Dalvik virtual machine process is actually what we call the Android application process . The android application process is created by the Activitymanagerservice service through the static member function of the Android.os.Process class, which requests the zygote process, and the ZYOGTE process eventually passes through the DALVIK.SYSTEM.Z The static member function of the Ygote class Forkandspecialize to create the Android application process.

Two. Dalvik the creation process of virtual machine threads

In Java code, we can create a Dalvik virtual machine thread through the Java.lang.Thread class's member function start.


1. The Dalvik virtual machine process is the local operating system process, which is the Linux process, except that the former runs a Dalvik virtual machine instance.

2. The Dalvik virtual machine thread is the local operating system process, the Linux thread, except that it is automatically attached to the Dalvik virtual machine when it is created, and the latter is appended to the Dalvik virtual machine when it needs to execute Java code.

The Dalvik virtual machine uses the process of the local operating system as its own process.

Pick From: http://blog.csdn.net/luoshengyang/article/details/8923484

Android Virtual machine learning Summary Dalvik virtual machine process and thread creation process analysis

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.