Zygote (深入理解android 卷1)
2014-12-16 16:01
441 查看
Zygote is just one Native’s app. It is created by theinit.rc. First, zygote’s name is app_process before. After the Linux’s pctrlcalling changed to zygote.
Zygote creates vm and system_server.
In AndroidRuntime.cpp
1. Create vm
Checkthe JNI function
Setup the heapsize to 16MB, someone will set to 32MB.
Checkthe resource of JNI. The Global reference cannot over 2000.
Callthe JNI_CreateJavaVM to create the VM. pEnv will send the JNIEnv value back tothe current job.
2. Register function
InstartReg function, the system will call register_init_procs() to enroll one JNIfunction.
Andit will call mProc(env). This function is just for register the JNI function.
3. Call Java function by JNI.(CallStaticVoidMethod)
The steps shows below:
1. Register socket for zygote.
2. Preload the classes and resources.
3. Start systemserver
4. runSelectLoopMode()
5. call run
SystemServer
IfSS killed, the Zygote will suicide with it.
Goals:
Init the native level.
Callstartclass. Call Binder to connect.
Startpower manager, battery manager, watchdog, window Manager, activity manager.
Createthe zygote
Sendthe signal to the zygote and create one thread. Set property, binderconncetion. At last , it will call invokestaticmain.
Zygote creates vm and system_server.
In AndroidRuntime.cpp
1. Create vm
Checkthe JNI function
Setup the heapsize to 16MB, someone will set to 32MB.
Checkthe resource of JNI. The Global reference cannot over 2000.
Callthe JNI_CreateJavaVM to create the VM. pEnv will send the JNIEnv value back tothe current job.
2. Register function
InstartReg function, the system will call register_init_procs() to enroll one JNIfunction.
Andit will call mProc(env). This function is just for register the JNI function.
3. Call Java function by JNI.(CallStaticVoidMethod)
The steps shows below:
1. Register socket for zygote.
2. Preload the classes and resources.
3. Start systemserver
4. runSelectLoopMode()
5. call run
SystemServer
IfSS killed, the Zygote will suicide with it.
Goals:
Init the native level.
Callstartclass. Call Binder to connect.
Startpower manager, battery manager, watchdog, window Manager, activity manager.
Createthe zygote
Sendthe signal to the zygote and create one thread. Set property, binderconncetion. At last , it will call invokestaticmain.
相关文章推荐
- 深入理解Android(05)——深入理解zygote
- 深入理解Android之init与zygote
- 深入理解Android(06)——Java世界的入口ZygoteInit
- [深入理解Android卷一全文-第四章]深入理解zygote
- 深入理解 Android 卷I - 第4章 深入理解 Zygote
- android启动--深入理解zygote (II)
- android启动--深入理解zygote (II)
- [深入理解Android卷一全文-第四章]深入理解zygote
- [深入理解Android卷一全文-第四章]深入理解zygote
- 深入理解 Android 卷I - 第4章 深入理解 Zygote
- [深入理解Android卷一全文-第四章]深入理解zygote
- android启动--深入理解zygote
- 深入理解Android(08)——深入理解zygote的分裂原理
- android启动--深入理解zygote
- android启动--深入理解zygote
- 深入理解Android消息处理系统——Looper、Handler、Thread
- Android入门:深入学习理解 Handler HandlerThread AsyncQueryHandler 三者的关系
- 深入理解Android消息处理系统——Looper、Handler、Thread
- (转)深入理解Android消息处理系统——Looper、Handler、Thread
- 深入理解Android消息处理系统——Looper、Handler、Thread