System Process zygote (1) -- Overview, zygote Overview

Source: Internet
Author: User

System Process zygote (1) -- Overview, zygote Overview

The gentle spring light is filled with a pond full of flowers and trees. Let's say goodbye to the lonely dream, come and touch me for a while, and fold a sea bread. -- Xu Zhimo wake up! Wake up!

Ilocker: Follow Android Security (New entry, 0 basics) QQ: 2597294287

First look at a figure (android boot sequence, the source is unknown ):

The underlying layer of android is linux kernel, which is loaded by bootloader. After the kernel is started, start the init process, and then start other processes required by the system, including the zygote process.

Processes started by init are described in the "system \ core \ rootdir \ root. rc" script:

 

Let's take a look at zygote. rc (taking init. zygote32.rc as an example ):

 

This script requires the init process to create a process named zygote. The program to be executed by this process is "/system/bin/app_process ". And create a socket resource for the zygote process (for inter-process communication, ActivityManagerService requests the zygote process to fork an application process through this socket ).

During initialization, the zygote process starts the Virtual Machine and loads some system resources. In this way, after zygote fork goes out of the sub-process, the sub-process also inherits the Virtual Machine and various system resources that can work normally. Then, you only need to load the bytecode of the apk file to run the application, it can greatly shorten the application startup time, which is the main role of the zygote process.

Java applications cannot run in the form of local processes. They must run in an independent virtual machine. If you restart the virtual machine every time, the startup speed of the application will be severely slowed down.

Linux processes are all fork-based. The fork-based sub-processes share the memory image with the parent process. The operating system allocates a new page for a child process to rewrite the memory, and copies the data on the old page to the new page, this is "Copy On Write )".

Learning Materials: (1) http://blog.csdn.net/luoshengyang/article/details/6768304 (2) the Android framework secrets (3) the in-depth analysis of Android 5.0 System

Related Article

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.