android process information

Android Process Information

  

本文描述了android启动之后的系统进程列表,并从log的角度来初步分析一下zygote进程的启动过程.

1 Process list:

 

  用PS可以得到进程列表,现就最主要的一些进程作一个简单的介绍:

      USER     PID   PPID  VSIZE RSS   WCHAN    PC         NAME

    root     1     0     548   196   c00b8c14 0000d5cc S /init

    ......

    root     734   1     72000 14172 c00b92b0 afe0c5a4 S zygote

    root     769   1     716   264   c02265ec afe0c1dc S /system/bin/logcat

    system   825   734   574128 28360 ffffffff afe0c47c S system_server

    radio    877   734   158260 20040 ffffffff afe0d404 S com.android.phone

    app_18   960   734   104180 15208 ffffffff afe0d404 S com.android.mms

    app_8    979   734   118860 14044 ffffffff afe0d404 S android.process.media

    app_9    991   734   91980 12264 ffffffff afe0d404 S com.android.alarmclock

    app_14   1025  734   95636 13036 ffffffff afe0d404 S com.android.calendar

    app_20   1146  734   99260 15320 ffffffff afe0d404 S com.android.music

    app_47   1157  734   100204 15964 ffffffff afe0d404 S com.motorola.camera

    app_11   1183  734   122672 23576 ffffffff afe0d404 S com.android.browser

    app_6    1199  734   117032 20388 ffffffff afe0d404 S oms.mobilemusic

    system   1244  734   99292 15940 ffffffff afe0d404 S com.android.settings

    ......

   正如linux系统一样,第一个启动的进程当然是init了。从以上可以看出,所有应用层的进程都是zygote 的子进程,事实上,jvm的初始化就是从zygote开始的,zygote是init的子进程,zygote是在通过init.rc中启动的。

我们再从以下的启动log 中来理解一下android的启动过程,包括runtime:

2 log:

 

    09-07 06:21:51.218: INFO/vold(538): Android Volume Daemon version 2.0

    09-07 06:21:51.227: INFO/DEBUG(539): debuggerd: Jun 30 2009 17:00:51

    09-07 06:21:51.247: ERROR/vold(538): Error opening switch name path '/sys/class/switch/test2' (No such file or directory)

    09-07 06:21:51.247: ERROR/vold(538): Error bootstrapping switch '/sys/class/switch/test2' (m)

    09-07 06:21:51.247: ERROR/vold(538): Error opening switch name path '/sys/class/switch/test' (No such file or directory)

    09-07 06:21:51.247: ERROR/vold(538): Error bootstrapping switch '/sys/class/switch/test' (m)

    09-07 06:21:51.247: DEBUG/vold(538): Bootstrapping complete

    09-07 06:21:51.397: ERROR/flash_image(544): can't find recovery partition

    09-07 06:21:51.468: DEBUG/qemud(546): entering main loop

    09-07 06:21:52.288: DEBUG/AndroidRuntime(541): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<

    09-07 06:21:52.288: DEBUG/AndroidRuntime(541): CheckJNI is ON

    09-07 06:21:52.407: DEBUG/qemud(546): fdhandler_accept_event: accepting on fd 10

    09-07 06:21:52.407: DEBUG/qemud(546): created client 0xe078 listening on fd 8

    09-07 06:21:52.407: DEBUG/qemud(546): fdhandler_event: disconnect on fd 8

    09-07 06:21:52.458: DEBUG/qemud(546): fdhandler_accept_event: accepting on fd 10

    09-07 06:21:52.458: DEBUG/qemud(546): created client 0xf028 listening on fd 8

    09-07 06:21:52.458: DEBUG/qemud(546): client_fd_receive: attempting registration for service 'gsm'

    09-07 06:21:52.458: DEBUG/qemud(546): client_fd_receive:    -> received channel id 1

    09-07 06:21:52.468: DEBUG/qemud(546): client_registration: registration succeeded for client 1

    09-07 06:21:52.937: INFO/(542): ServiceManager: 0xac38

    09-07 06:21:52.957: INFO/AudioFlinger(542): AudioFlinger's thread ready to run for output 0

    09-07 06:21:52.957: INFO/CameraService(542): CameraService started: pid=542

    09-07 06:21:52.978: DEBUG/AndroidRuntime(541): --- registering native functions ---

    09-07 06:21:53.308: INFO/Zygote(541): Preloading classes...

    09-07 06:21:53.318: DEBUG/dalvikvm(541): GC freed 764 objects / 42216 bytes in 11ms

    09-07 06:21:53.517: DEBUG/dalvikvm(541): GC freed 278 objects / 17160 bytes in 4ms

    09-07 06:21:53.898: DEBUG/dalvikvm(541): GC freed 208 objects / 12696 bytes in 6ms

    09-07 06:21:53.988: DEBUG/dalvikvm(541): Trying to load lib /system/lib/libmedia_jni.so 0x0

    09-07 06:21:54.148: DEBUG/dalvikvm(541): Added shared lib /system/lib/libmedia_jni.so 0x0

    09-07 06:21:54.148: DEBUG/dalvikvm(541): Trying to load lib /system/lib/libmedia_jni.so 0x0

    09-07 06:21:54.158: DEBUG/dalvikvm(541): Shared lib '/system/lib/libmedia_jni.so' already loaded in same CL 0x0

    09-07 06:21:54.158: DEBUG/dalvikvm(541): Trying to load lib /system/lib/libmedia_jni.so 0x0

    09-07 06:21:54.158: DEBUG/dalvikvm(541): Shared lib '/system/lib/libmedia_jni.so' already loaded in same CL 0x0

    09-07 06:21:54.158: DEBUG/dalvikvm(541): Trying to load lib /system/lib/libmedia_jni.so 0x0

    09-07 06:21:54.158: DEBUG/dalvikvm(541): Shared lib '/system/lib/libmedia_jni.so' already loaded in same CL 0x0

    09-07 06:21:54.168: DEBUG/dalvikvm(541): GC freed 462 objects / 29144 bytes in 8ms

    ......

    09-07 06:22:03.509: INFO/dalvikvm(541): Splitting out new zygote heap

    09-07 06:22:03.569: INFO/dalvikvm(541): System server process 570 has been created

    09-07 06:22:03.569: INFO/Zygote(541): Accepting command socket connections

    09-07 06:22:03.638: INFO/jdwp(570): received file descriptor 10 from ADB

    09-07 06:22:03.797: DEBUG/dalvikvm(570): Trying to load lib /system/lib/libandroid_servers.so 0x0

    ......

    09-07 06:22:04.179: INFO/SystemServer(570): Entered the Android system server!

    09-07 06:22:04.209: INFO/sysproc(570): System server: entering thread pool.

    09-07 06:22:04.267: ERROR/GLLogger(570): couldn't load <libhgl.so> library (Cannot find library)

    09-07 06:22:04.338: INFO/SystemServer(570): Starting Power Manager.

    09-07 06:22:04.387: INFO/ARMAssembler(570): generated scanline__00000077:03545404_00000A01_00000000 [ 30 ipp] (51 ins) at [0x190ed0:0x190f9c] in 6840752 ns

    09-07 06:22:04.397: INFO/SystemServer(570): Starting Activity Manager.

    09-07 06:22:04.578: INFO/SystemServer(570): Starting telephony registry

    09-07 06:22:04.588: INFO/SystemServer(570): Starting Package Manager.

    09-07 06:22:04.619: INFO/Installer(570): connecting...

    09-07 06:22:04.619: INFO/installd(543): new connection

    09-07 06:22:04.717: INFO/PackageManager(570): Got library android.awt in /system/framework/android.awt.jar

    09-07 06:22:04.728: INFO/PackageManager(570): Got library android.test.runner in /system/framework/android.test.runner.jar

    09-07 06:22:04.728: INFO/PackageManager(570): Got library com.android.im.plugin in /system/framework/com.android.im.plugin.jar

    09-07 06:22:05.078: DEBUG/PackageManager(570): Scanning app dir /system/framework

    ......

07 06:22:07.780: INFO/SystemServer(570): Starting Window Manager.

   ......

07 06:22:22.187: DEBUG/HomeLoaders(611):   --> starting applications loader

   ......

   

从log 中也可以看出:

1. 在zygote启动之后,GC在不停地进行垃圾回收;

2. Framework中的组件都是在SystemServer初始化的,这一点,从android的源码也能看出来;

3. 最后是启动应用层的组件.

你可能感兴趣的:(android,android,log,logcat,logcat,android进程)