标签:dal prope col pow android write cpp hat fico
Zygote是Android系统创建新进程的核心进程,负责启动Dalvik虚拟机,加载一些必要的系统资源和系统类,启动system_server进程,随后进入等待处理app应用请求
Zygote涉及的主要代码如下
frameworks/base/cmds/app_process/App_main.cpp frameworks/base/core/jni/AndroidRuntime.cpp frameworks/base/core/java/com/android/internal/os/ - Zygote.java - ZygoteInit.java - ZygoteServer.java - ZygoteConnection.java
Zygote进程由init启动,在笔者开发板上是以app_process64为主模式,app_process为辅
# /vendor/default.prop ro.zygote=zygote64_32 # /init.rc import /init.${ro.zygote}.rc on zygote-start && property:ro.crypto.state=... # A/B update verifier that marks a successful boot. exec_start update_verifier_nonencrypted start netd start zygote start zygote_secondary # /init.zygote64_32.rc service zygote /system/bin/app_process64 -Xzygote /system/bin --zygote --start-system-server --socket-name=zygote class main priority -20 user root group root readproc reserved_disk socket zygote stream 660 root system onrestart write /sys/android_power/request_state wake onrestart write /sys/power/state on onrestart restart audioserver onrestart restart cameraserver onrestart restart media onrestart restart netd onrestart restart wificond writepid /dev/cpuset/foreground/tasks service zygote_secondary /system/bin/app_process32 -Xzygote /system/bin --zygote --socket-name=zygote_secondary --enable-lazy-preload class main priority -20 user root group root readproc reserved_disk socket zygote_secondary stream 660 root system onrestart restart zygote writepid /dev/cpuset/foreground/tasks
属性 ro.zygote 的值包括zygote32、zygote64、zygote32_64、zygote64_32,对应区别如下:
- init.zygote64.rc:zygote进程对应的执行程序是app_process64(纯64bit模式)
- init.zygote32_64.rc:启动两个zygote进程,对应的执行程序分别是app_process32(主模式)、app_process64
- init.zygote64_32.rc:启动两个zygote进程,对应的执行程序分别是app_process64(主模式)、app_process32
下面主要分析app_process
https://www.ctolib.com/topics-105450.html
https://www.jianshu.com/p/ab9b83a77af6
https://www.cnblogs.com/pepsimaxin/p/9448874.html
https://blog.csdn.net/kai_zone/article/details/81637315
标签:dal prope col pow android write cpp hat fico
原文地址:https://www.cnblogs.com/hzl6255/p/12142762.html