andriod zygote

/system/bin/app_process64   作为service 被启动,启动后comm:改成main ,cmdline 改成 zygote ,

main ->  runtime.start( com.android.internal.os.ZygoteInit)   调用在frameworks/base/core/jni/AndroidRuntime.cpp文件中的父类   AndriodRuntime::start ()  {启动虚拟机)  }  }  

c语言里通过JNI语法直接调用了java语言的 com.android.internal.os.ZygoteInit 类在 frameworks/base/core/java/com/android/internal/os/ZygoteInit.java

main-> startSystemServer()  -> Zygote.forkSystemServer { nativeForkSystemServer{}    }   

                                             ->  handleSystemServerProcess {} 

nativeForkSystemServer :   JAVA里面调用C  ,jni 实现在frameworks/base/core/jni/com_android_internal_os_Zygote.cpp下的com_android_internal_os_Zygote_nativeForkSystemServer() : fork  出来的进程进程,改了 comm 到system_server

-> ForkAndSpecializeCommon -> SetThreadName-> pthread_setname_np

 

posted @ 2018-04-28 11:24  stachal  阅读(137)  评论(0)    收藏  举报