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)