android系統中進程介紹

計算機的基本任務就是運行應用程序,也就是進程。下面列出了andoird在手機上運行的進程:(adb shell, ps命令)

USER PID PPID VSIZE RSS WCHAN PC NAME 
root 1 0 548 196 c00b8c14 0000d5cc S / init 
root 2 0 0 0 c006bf70 00000000 S kthreadd 
root 3 2 0 0 c005cc50 00000000 S ksoftirqd / 0 
root 4 2 0 0 c007e408 00000000 S watchdog / 0 
root 5 2 0 0 c0068eec 00000000 S events / 0 
root 6 2 0 0 c0068eec 00000000 S khelper 
root 10 2 0 0 c0224f90 00000000 S suspend / 0 
root 81 2 0 0 c0068eec 00000000 S kblockd / 0 
root 89 2 0 0 c01f2f7c 00000000 S kseriod 
root 111 2 0 0 c0068eec 00000000 S kmmcd 
root 117 2 0 0 c0068eec 00000000 S btaddconn 
root 118 2 0 0 c0068eec 00000000 S btdelconn 
root 135 2 0 0 c00448e0 00000000 S bpmd 
root 141 2 0 0 c008b5f4 00000000 S pdflush 
root 142 2 0 0 c008b5f4 00000000 S pdflush 
root 143 2 0 0 c008f948 00000000 S kswapd0 
root 189 2 0 0 c0068eec 00000000 S aio / 0 
root 195 2 0 0 c01721f0 00000000 S mtdblockd 
root 340 2 0 0 c01b4eb0 00000000 S accessory notif 
root 349 2 0 0 c0068eec 00000000 S camera_task / 0 
root 376 2 0 0 c0061438 00000000 S w1_control 
root 378 2 0 0 c0061438 00000000 S w1_bus_master1 
root 386 2 0 0 c0068eec 00000000 S charge 
root 428 2 0 0 c02ca26c 00000000 S krfcommd 
root 430 2 0 0 c0068eec 00000000 S rpciod / 0 
root 724 2 0 0 c0216908 00000000 S mmcqd 
root 726 1 772 180 c019dbc4 afe0c1dc S / system / bin / sh 
system 727 1 840 188 c022d8a0 afe0c47c S / system / bin / servicemanager 
root 729 1 1920 336 ffffffff afe0c1dc S / system / bin / mountd 
root 730 1 704 176 c0257854 afe0ce0c S / system / bin / debuggerd 
root 731 1 4132 628 c027e2f8 afe0ce0c S / opl / bin / tcmd 
root 732 1 852 248 c00b92b0 afe0c5a4 S / opl / bin / adapter 
radio 733 1 12796 648 ffffffff beaab18c S / system / bin / rild 
root 734 1 72000 14172 c00b92b0 afe0c5a4 S zygote 
root 735 1 33848 4512 ffffffff afe0c47c S / system / bin / mediaserver 
root 736 1 1080 216 c00b8c14 bedc021c S / system / bin / dbus-daemon 
root 737 1 832 208 c02b6e80 afe0c1dc S / system / bin / installd 
root 740 1 856 260 c00b92b0 afe0c5a4 S / opl / bin / bpd 
root 741 1 828 172 c00b8c14 afe0d27c S / opl / bin / battmond 
root 768 1 720 272 c02265ec afe0c1dc S / system / bin / logcat 
root 769 1 716 264 c02265ec afe0c1dc S / system / bin / logcat 
root 816 2 0 0 c0068eec 00000000 S battery.0 
system 825 734 5741 28 28360 ffffffff afe0c47c S system_server 
radio 877 734 1582 60 20040 ffffffff afe0d404 S com.android.phone 
app_5 879 734 1008 88 13616 ffffffff afe0d404 S android.process.acore 
system 882 734 1446 64 24296 ffffffff afe0d404 S android.process.omsservice 
app_45 884 734 9230 4 10932 ffffffff afe0d404 S com.motorola.motohome 
app_22 890 734 1170 68 30228 ffffffff afe0d404 S oms.home 
app_3 918 734 9876 0 12652 ffffffff afe0d404 S oms.widgetmanager 
app_5 928 734 1008 88 13336 ffffffff afe0d404 S com.android.inputmethod.borqs 
app_24 930 734 1051 76 19168 ffffffff afe0d404 S com.db4o.servo.search 
app_18 960 734 1041 80 15208 ffffffff afe0d404 S com.android.mms 
app_8 979 734 1188 60 14044 ffffffff afe0d404 S android.process.media 
app_9 991 734 9198 0 12264 ffffffff afe0d404 S com.android.alarmclock 
app_15 998 734 1031 44 12908 ffffffff afe0d404 S oms.dcd 
system 1018 734 94732 13792 ffffffff afe0d404 S oms.dm 
app_14 1025 734 95636 13036 ffffffff afe0d404 S com.android.calendar 
app_42 1041 734 93292 11316 ffffffff afe0d404 S com.motorola.smsautoreg 
app_40 1090 734 97152 15192 ffffffff afe0d404 S com.motorola.mtc 
app_38 1102 734 93832 12868 ffffffff afe0d404 S com.streamezzo.browser.android 
app_26 1115 734 96596 15084 ffffffff afe0d404 S oms.mediacenter 
app_37 1126 734 98208 15212 ffffffff afe0d404 S com.hyfsoft.docviewer 
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 
app_23 1311 734 96932 16004 ffffffff afe0d404 S oms.bru 
root 1334 2 0 0 c0216908 00000000 S mmcqd 
app_8 1351 734 100308 15876 ffffffff afe0d404 S com.android.camera 
app_1 1424 734 111904 17024 ffffffff afe0d404 S oms.messaging 
app_4 1436 734 101172 15504 ffffffff afe0d404 S oms.mail 
app_2 1484 734 100716 18128 ffffffff afe0d404 S com.ms 
app_16 1663 734 101024 16748 ffffffff afe0d404 S oms.android.filemanager 
root 1684 1 3364 176 ffffffff 0000e8f4 S / sbin / adbd 
root 1692 1684 776 348 c0059cd4 afe0d0ac S / system / bin / sh 
root 1724 1692 920 356 0000 0000 afe0c1dc R ps

讓我們來看一下這些進程都是什麼。首先是init進程,也就是linux 1號進程,父進程是0。init由0號進程創建,完成系統的初始化. 是系統中所有其它用戶進程的祖先進程。

0號進程Linux引導中創建的第一個進程,完成加載系統後,演變爲進程調度、交換及存儲管理進程。

2號進程kthreadd PPID 0,它的子進程有很多,像ksoftirqd,watchdog等內核進程。

在然後是sh, ServiceManager,mountd, rild, zygote, mediaserver, logcat等等,他們的父進程都是init, init按init.rc啓動進程,這些進程都是用C/C++遍寫的。

下面是應用程序進程,
在Android系統中,應用程序進程都是由Zygote進程的子進程。Zygote進程在啓動時會創建一個Dalvik虛擬機實例,每當它fork一個新的應用程序進程時,都會將這個Dalvik虛擬機實例複製到新的應用程序進程裏面去,從而使得每一個應用程序進程都有一個獨立的Dalvik虛擬機實例。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章