Android source code----Android System start-up process (initial research source code, improper expression also forgive me)

Source: Internet
Author: User

Android is actually an application in the Linux system, the corresponding program is app_process, the program is declared in the init.rc, the Linux startup will start the zygote (app_process) process (the program is implemented by Java code, Run by Dalvik virtual machine, corresponding code in Latest-android-2.3.7_r1\android-2.3.7_r1\frameworks\base\core\java\com\android\internal\os\ In Zygoteinit.java)


Directory of files in the Android system



Init.rc file path and content in Android 2.3 source code



Latest-android-2.3.7_r1\android-2.3.7_r1\frameworks\base\core\java\com\android\internal\os\ Key code in Zygoteinit.java



The service-side socket is first started in the main function to receive commands to start the Dalvik process

Then load the shared classes and resource files on the Android system, and Zygoteinit will load the shared class based on the preload_classes file.


Preload_classes file location and content

A total of 1830 classes are listed in the file, all of which need to be loaded, loading is slow, but loading means that most of the shared classes are already loaded when the Android app is running, which improves the speed of the Android app



The resource file load is loaded according to the declaration in Latest-android-2.3.7_r1\android-2.3.7_r1\frameworks\base\core\res\res\values\arrays.xml

The contents of the file are as follows



After loading the above resources Zygote will hatch out the first Dalvik process systemserver,systemserver will create a socket client, which is managed by Activitymanageservice, All subsequent Dalvik processes will be started indirectly through the socket client, and when a new APK process is required, AMS sends a start command to the socket server of the zygote process through the socket client, and Zygote will hatch a new process



Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Android source code----Android System start-up process (initial research source code, improper expression also forgive me)

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.