Android Source code----The startup process of Android (initial research source code, the presentation of improper also forgive me)

Source: Internet
Author: User

The Android system is actually an application in a Linux system. The corresponding program is app_process, and the program is declared in Init.rc. Linux starts the zygote (app_process) session, which is implemented by Java code and executed by the Dalvik virtual machine, and the corresponding code is latest-android-2.3.7_r1\android-2.3.7_r1\ In Frameworks\base\core\java\com\android\internal\os\zygoteinit.java)


Files folder in Android system

Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /center ">



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

Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /center ">


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

It then loads the classes and resource files that are shared by the app on some Android systems. Zygoteinit will load the shared class according to the preload_classes file


Preload_classes file location and content

A total of 1830 classes are listed in the file, which are required to be loaded and loaded, causing slow booting. But loading more means that most of the shared classes are already loaded when the Android app executes, which increases the speed of Android app execution



The resource file 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 file contents such as the following



After loading the above resources Zygote will hatch out the first Dalvik process systemserver,systemserver a socketclient is created and managed by Activitymanageservice. After all the Dalvik processes will be started indirectly through the socketclient, when a new apk process is required, AMS sends a start command to the socket server of the zygote process via the socketclient. Then Zygote will hatch a new process.



Android Source code----The startup process of Android (initial research source code, the presentation of improper 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.