Android system boot process analysis

Android system boot process analysis

Open adb shell and then execute the ps command, you can see the init method first performed! Init.c find the file.
Then go inside the main init method, in which the main method of execution mkdir which created a lot of folders, and mount some directories
and then go back and initialize init.rc this profile! In this configuration file back inside an incubator to start this service, this service will start app_process to this folder, this folder inside a app_main.cpp this file!
Then app_main.cpp the c file inside it to start the Android virtual machine inside the main method, then the virtual Android chance to start os.zygoteinit this service!
zygoteinit This is a java code to write, and then we found the main way in which this method we first saw him set the minimum heap memory of the virtual machine is 5 trillion, then went preloadclasses () method to load this Android All 2000 more than one class by class loader come in such activity, contentx, http, ... (in fact, there is no need to load down once and for all, we can wait time can also be used in load!)
and then go preloadresources () method to this pre-defined load Andrews good resources such as color, pictures, system id, and so on. . . We are loaded! (In fact, this is not necessary!)
And then go startSystemServer (), this method to load the system's service! He will first use natvieJNI to call C Service interface to initialize and sound, which is why we first hear the voice of reason and interface!
Once finished loading the last service will start up!

== summary linux boot -> init process start (load init.rc Configuration) -> zygote Start -> systemServer start, systemServer starts navite world and the java world == through init1 and init2

Published 42 original articles · won praise 115 · views 10000 +

Guess you like

Origin blog.csdn.net/luoyong_blog/article/details/84798545