In an Android system, the application process is hatched by the zygote process, and the zygote process is initiated by the INIT process. The zygote process creates a Dalvik virtual machine instance at startup, and whenever it hatches a new application process, it copies the Dalvik virtual machine instance into the new application process, allowing each application process to have a separate Dalvik virtual machine instance. In this article, we analyze the startup process of the Dalvik virtual machine in the zygote process.
zygote process, in addition to creating a Dalvik virtual machine instance, also loads the Java Runtime library into the process and registers some of the Android core class's JNI methods to the Dalvik virtual machine instance created earlier But, overall, is more beneficial than the disadvantage, after all, the whole system has only one zygote process, and there may be countless application processes, and we do not often go to shut down the phone, in most cases just let it go into hibernation.
This startup process is mainly accomplished by the following four things:
1. Created a Dalvik virtual machine instance;
2. The Java core class and its JNI methods are loaded;
3. Set up a JNI environment for the main thread;
4. The Jni method of the Android core class is registered.
in other words, the zygote process prepares an Dalvik virtual machine instance for the Android system, and later zygote the process to create the Android application process, It is possible to copy its own Dalvik virtual machine instance into the newly created Android application process, thus speeding up the process of the Android application process. In addition, the Java core classes and the Android core classes (in the Dex file), and their JNI methods (in the so file), are read in memory-mapped ways, so thatthezygote process, when creating an Android application process, In addition to replicating your own Dalvik virtual machine instances to the newly created Android application process, you can also share the Java core classes and Android core classes with the newly created Android application process, along with their JNI methods, thus saving memory consumption.
Pick From: http://blog.csdn.net/luoshengyang/article/details/8885792
Android Dalvik Startup Process Summary