您的位置:首页 > 移动开发 > Android开发

android重要进程的主要功能

2016-08-10 18:29 946 查看
使用adb命令 adb shell ps -p 或者 adb shell ps -p -t -P 可以发现很多进程信息, 那么问题来了. 这些进程的主要功能是什么?

命令执行结果如下:

USER      PID   PPID  VSIZE  RSS  PRIO  NICE  RTPRI SCHED  WCHAN            PC  NAME

root      1     0     2488   856   20    0     0     0     sys_epoll_ 000710f4 S /init

root      2     0     0      0     -2    0     1     1       kthreadd 00000000 S kthreadd

root      3     2     0      0     20    0     0     0     run_ksofti 00000000 S ksoftirqd/0

root      5     2     0      0     0     -20   0     0     worker_thr 00000000 S kworker/0:0H

root      6     2     0      0     20    0     0     0     msm_mpm_wo 00000000 D kworker/u:0

root      7     2     0      0     0     -20   0     0     msm_rpm_sm 00000000 D kworker/u:0H

root      8     2     0      0     -100  0     99    1     cpu_stoppe 00000000 S migration/0

root      21    2     0      0     0     -20   0     0     rescuer_th 00000000 S khelper

root      22    2     0      0     0     -20   0     0     rescuer_th 00000000 S netns

root      23    2     0      0     20    0     0     0     worker_thr 00000000 S kworker/0:1

root      27    2     0      0     0     -20   0     0     worker_thr 00000000 S kworker/0:1H

root      28    2     0      0     0     -20   0     0     rescuer_th 00000000 S modem_notifier

root      29    2     0      0     0     -20   0     0     rescuer_th 00000000 S smd_channel_clo

root      30    2     0      0     0     -20   0     0     rescuer_th 00000000 S smsm_cb_wq

root      32    2     0      0     0     -20   0     0     rescuer_th 00000000 S rpm-smd

root      33    2     0      0     0     -20   0     0     worker_thr 00000000 S kworker/u:1H

root      34    2     0      0     0     -20   0     0     rescuer_th 00000000 S mpm

root      51    2     0      0     20    0     0     0     bdi_sync_s 00000000 S sync_supers

root      52    2     0      0     20    0     0     0     bdi_forker 00000000 S bdi-default

root      53    2     0      0     0     -20   0     0     rescuer_th 00000000 S kblockd

root      54    2     0      0     20    0     0     5     ion_heap_d 00000000 S system

root      55    2     0      0     20    0     0     0     hub_thread 00000000 S khubd

root      56    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/99-msm_iomm

root      57    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/105-msm_iom

root      58    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/77-msm_iomm

root      59    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/70-msm_iomm

root      60    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/94-msm_iomm

root      61    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/102-msm_iom

root      62    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/102-msm_iom

root      63    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/102-msm_iom

root      64    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/79-msm_iomm

root      65    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/78-msm_iomm

root      66    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/78-msm_iomm

root      67    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/74-msm_iomm

root      68    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/75-msm_iomm

root      69    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/75-msm_iomm

root      70    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/75-msm_iomm

root      71    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/75-msm_iomm

root      72    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/273-msm_iom

root      73    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/273-msm_iom

root      74    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/273-msm_iom

root      75    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/97-msm_iomm

root      76    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/97-msm_iomm

root      77    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/97-msm_iomm

root      78    2     0      0     0     -20   0     0     rescuer_th 00000000 S devfreq_wq

root      79    2     0      0     0     -20   0     0     rescuer_th 00000000 S l2cap

root      80    2     0      0     0     -20   0     0     rescuer_th 00000000 S a2mp

root      81    2     0      0     0     -20   0     0     rescuer_th 00000000 S cfg80211

root      93    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/475-adsp

root      94    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/411-mba

root      95    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/539-wcnss

root      96    2     0      0     0     -20   0     0     rescuer_th 00000000 S qmi

root      97    2     0      0     0     -20   0     0     rescuer_th 00000000 S nmea

root      98    2     0      0     0     -20   0     0     rescuer_th 00000000 S msm_ipc_router

root      99    2     0      0     0     -20   0     0     rescuer_th 00000000 S apr_driver

root      103   2     0      0     20    0     0     0         kswapd 00000000 S kswapd0

root      104   2     0      0     20    0     0     0     fsnotify_m 00000000 S fsnotify_mark

root      105   2     0      0     20    0     0     0     ecryptfs_t 00000000 S ecryptfs-kthrea

root      106   2     0      0     0     -20   0     0     rescuer_th 00000000 S cifsiod

root      107   2     0      0     0     -20   0     0     rescuer_th 00000000 S crypto

root      127   2     0      0     0     -20   0     0     rescuer_th 00000000 S ad_calc_wq

root      128   2     0      0     -17   0     16    1     dsi_event_ 00000000 D mdss_dsi_event

root      129   2     0      0     0     -20   0     0     rescuer_th 00000000 S k_hsuart

root      130   2     0      0     0     -20   0     0     rescuer_th 00000000 S diag_real_time_

root      131   2     0      0     0     -20   0     0     rescuer_th 00000000 S diag_modem_data

root      132   2     0      0     0     -20   0     0     rescuer_th 00000000 S diag_lpass_data

root      133   2     0      0     0     -20   0     0     rescuer_th 00000000 S diag_wcnss_data

root      134   2     0      0     0     -20   0     0     rescuer_th 00000000 S diag_wq

root      135   2     0      0     0     -20   0     0     rescuer_th 00000000 S diag_usb_wq

root      136   2     0      0     0     -20   0     0     rescuer_th 00000000 S diag_cntl_wq

root      137   2     0      0     0     -20   0     0     rescuer_th 00000000 S diag_dci_wq

root      138   2     0      0     0     -20   0     0     rescuer_th 00000000 S kgsl-3d0

root      139   2     0      0     0     -20   0     0     rescuer_th 00000000 S kgsl-events

root      140   2     0      0     0     -20   0     0     rescuer_th 00000000 S kgsl_devfreq_wq

root      147   2     0      0     0     -20   0     0     rescuer_th 00000000 S usbnet

root      148   2     0      0     0     -20   0     0     rescuer_th 00000000 S k_rmnet_mux_wor

root      149   2     0      0     0     -20   0     0     rescuer_th 00000000 S f_mdb_data

root      150   2     0      0     0     -20   0     0     rescuer_th 00000000 S f_mtp

root      151   2     0      0     20    0     0     0     sleep_thre 00000000 S file-storage

root      152   2     0      0     0     -20   0     0     rescuer_th 00000000 S uether

root      153   2     0      0     0     -20   0     0     rescuer_th 00000000 S kpsmoused

root      155   2     0      0     0     -20   0     0     rescuer_th 00000000 S msm_vidc_worker

root      156   2     0      0     0     -20   0     0     rescuer_th 00000000 S pm_workerq_venu

root      157   2     0      0     0     -20   0     0     rescuer_th 00000000 S msm_vidc_worker

root      158   2     0      0     0     -20   0     0     rescuer_th 00000000 S msm_cpp_workque

root      159   2     0      0     20    0     0     0     dbs_sync_t 00000000 D dbs_sync/0

root      160   2     0      0     20    0     0     0     dbs_sync_t 00000000 D dbs_sync/1

root      161   2     0      0     20    0     0     0     dbs_sync_t 00000000 D dbs_sync/2

root      162   2     0      0     20    0     0     0     dbs_sync_t 00000000 D dbs_sync/3

root      163   2     0      0     -100  0     99    1     cpufreq_in 00000000 S cfinteractive

root      164   2     0      0     -51   0     50    1     irq_thread 00000000 S irq/170-msm_sdc

root      165   2     0      0     -51   0     50    1     irq_thread 00000000 S irq/253-msm_sdc

root      166   2     0      0     0     -20   0     0     rescuer_th 00000000 S binder

root      167   2     0      0     0     -20   0     0     rescuer_th 00000000 S usb_bam_wq

root      168   2     0      0     10    -10   0     0     rfcomm_run 00000000 S krfcommd

root      169   2     0      0     0     -20   0     0     rescuer_th 00000000 S bam_dmux_rx

root      170   2     0      0     0     -20   0     0     rescuer_th 00000000 S bam_dmux_tx

root      171   2     0      0     0     -20   0     0     rescuer_th 00000000 S rq_stats

root      185   2     0      0     0     -20   0     0     rescuer_th 00000000 S deferwq

root      186   2     0      0     0     -20   0     0     rescuer_th 00000000 S sb-1

root      187   2     0      0     -51   0     50    1     irq_thread 00000000 S irq/195-ngd_sli

root      188   2     0      0     20    0     0     0     ngd_slim_r 00000000 D ngd_rx_thread1

root      189   2     0      0     20    0     0     0     ngd_notify 00000000 D ngd_notify_sl1

root      193   2     0      0     20    0     0     0     mmc_queue_ 00000000 S mmcqd/0

root      194   2     0      0     20    0     0     0     mmc_queue_ 00000000 S mmcqd/0rpmb

root      195   2     0      0     -51   0     50    1     irq_thread 00000000 S irq/299-bsi-bat

root      196   2     0      0     -51   0     50    1     irq_thread 00000000 S irq/344-atmel_m

root      197   2     0      0     20    0     0     0     ir_raw_eve 00000000 S rc0

root      199   2     0      0     -99   0     98    1     do_hotplug 00000000 S msm_thermal:hot

root      200   2     0      0     -100  0     99    1     do_freq_mi 00000000 S msm_thermal:fre

root      201   2     0      0     20    0     0     0     do_thermal 00000000 S msm_thermal:the

root      202   2     0      0     20    0     0     0     boost_mig_ 00000000 S boost_sync/0

root      203   2     0      0     20    0     0     0     boost_mig_ 00000000 S boost_sync/1

root      204   2     0      0     20    0     0     0     boost_mig_ 00000000 S boost_sync/2

root      205   2     0      0     20    0     0     0     boost_mig_ 00000000 S boost_sync/3

root      208   1     2228   560   20    0     0     0              0 000684c8 R /sbin/ueventd

root      210   2     0      0     20    0     0     0     kjournald2 00000000 S jbd2/mmcblk0p23

root      211   2     0      0     0     -20   0     0     rescuer_th 00000000 S ext4-dio-unwrit

root      214   2     0      0     20    0     0     0     bdi_writeb 00000000 S flush-179:0

root      216   2     0      0     20    0     0     0     worker_thr 00000000 S kworker/0:3

root      217   2     0      0     20    0     0     0     worker_thr 00000000 S kworker/0:4

root      218   2     0      0     20    0     0     0     kjournald2 00000000 S jbd2/mmcblk0p25

root      219   2     0      0     0     -20   0     0     rescuer_th 00000000 S ext4-dio-unwrit

root      220   2     0      0     20    0     0     0     kjournald2 00000000 S jbd2/mmcblk0p24

root      221   2     0      0     0     -20   0     0     rescuer_th 00000000 S ext4-dio-unwrit

root      222   2     0      0     20    0     0     0     kjournald2 00000000 S jbd2/mmcblk0p21

root      223   2     0      0     0     -20   0     0     rescuer_th 00000000 S ext4-dio-unwrit

logd      224   1     24268  13224 20    0     0     3     sys_rt_sig b6d94c38 S /system/bin/logd

root      229   2     0      0     20    0     0     0     kauditd_th 00000000 S kauditd

root      231   1     9240   1724  20    0     0     0     hrtimer_na b6ce280c S /system/bin/vold

root      248   2     0      0     0     -20   0     0     rescuer_th 00000000 S IPCRTR

root      249   2     0      0     0     -20   0     0     rescuer_th 00000000 S ipc_rtr_q6_ipcr

root      263   2     0      0     20    0     0     0     kthread_wo 00000000 S msm_slim_qmi_cl

root      264   2     0      0     0     -20   0     0     rescuer_th 00000000 S msm_qmi_rtx_q

root      274   1     2460   428   20    0     0     0     sys_epoll_ 000371b0 S /sbin/healthd

root      275   1     3072   852   -2    0     1     1     sys_epoll_ b6f27984 S /system/bin/lmkd

system    276   1     3116   1048  20    0     0     0     binder_thr b6e13ab0 S /system/bin/servicemanager

system    277   1     119388 16320 12    -8    0     0     sys_epoll_ b6dff984 S /system/bin/surfaceflinger

root      279   2     0      0     -51   0     50    1     irq_thread 00000000 S irq/288-wcd9xxx

nobody    280   1     9408   1148  20    0     0     0     poll_sched b6e91b74 S /system/bin/rmt_storage

system    281   1     4564   960   20    0     0     0     poll_sched b6e6ab74 S /system/bin/rfs_access

system    283   1     4300   1008  20    0     0     0        do_wait b6eb3234 S /system/bin/qseecomd

root      285   1     4080   1384  20    0     0     0     __skb_recv b6dada3c S zygote

root      288   1     16340  2088  20    0     0     0     hrtimer_na b6c9880c S /system/bin/netd

root      289   1     3804   1508  20    0     0     0     __skb_recv b6ddc8e8 S /system/bin/debuggerd

radio     290   1     58588  12436 20    0     0     0     hrtimer_na b6e4780c S /system/bin/rild

drm       291   1     16952  5360  20    0     0     0     binder_thr b6cc7ab0 S /system/bin/drmserver

media     292   1     156568 30032 20    0     0     0     binder_thr b6a73ab0 S /system/bin/mediaserver

root      293   1     2844   1072  20    0     0     0     unix_strea b6e3f960 S /system/bin/installd

keystore  295   1     5868   2264  20    0     0     0     binder_thr b6d12ab0 S /system/bin/keystore

system    297   1     39460  11312 20    0     0     0     binder_thr b6e58ab0 S /system/xbin/shelld

root      298   1     5840   1312  20    0     0     0     poll_sched b6e73b4c S /system/bin/qcom-system-daemon

media     302   1     3920   928   20    0     0     0     poll_sched b6df1b4c S /system/bin/adsprpcd

system    303   1     5904   1284  20    0     0     0     poll_sched b6d3db74 S /system/bin/imsqmidaemon

system    304   1     6684   2136  20    0     0     0     wcnss_wlan b6ea5960 S /system/bin/wcnss_service

root      305   1     1537176 67416 20    0     0     0     poll_sched b6d18b4c S zygote

root      306   1     3240   1276  20    0     0     0     __skb_recv b6ec58e8 S /system/xbin/su

root      307   1     6948   1408  20    0     0     0     binder_thr b6e25ab0 S /system/bin/fdpp

system    308   1     21744  1964  20    0     0     0     binder_thr b6d3eab0 S /system/bin/gatekeeperd

system    309   1     47100  13260 20    0     0     0     sys_epoll_ b6bd7984 S /system/bin/cnd

root      310   1     6600   1636  20    0     0     0     unix_strea b6d75960 S /system/bin/dpmd

gps       312   1     4504   1432  20    0     0     0     sys_rt_sig b6e7dc38 S /system/bin/loc_launcher

camera    315   1     70104  15840 20    0     0     0     poll_sched b6c79b74 S /system/bin/mm-qcamera-daemon

system    316   1     10720  1864  20    0     0     0     futex_wait b6ebf63c S /system/bin/time_daemon

system    318   1     17736  5324  20    0     0     0     binder_thr b6d28ab0 S /system/bin/audiod

root      319   1     8028   1592  20    0     0     0     binder_thr b6dffab0 S /system/bin/displayfeature

root      323   1     54256  2280  0     -20   0     0     sys_rt_sig b6dabc38 S /system/vendor/bin/thermal-engine

root      366   2     0      0     -51   0     50    1     irq_thread 00000000 S irq/33-cpubw_hw

system    376   283   8536   656   20    0     0     0     sys_rt_sig b6eb1c38 S /system/bin/qseecomd

gps       378   312   10160  1668  20    0     0     0     futex_wait b6e0d63c S lowi-server

gps       379   312   19696  1352  20    0     0     0     futex_wait b6f0263c S xtwifi-inet-agent

gps       380   312   25480  4684  20    0     0     0     futex_wait b6ae063c S xtwifi-client

gps       381   312   19096  3492  20    0     0     0     poll_sched b6be5b4c S slim_daemon

root      394   2     0      0     20    0     0     0     worker_thr 00000000 S kworker/u:5

nobody    398   1     3620   984   20    0     0     0     poll_sched b6e67b4c S /system/bin/hvdcp

system    399   1     47200  11644 20    0     0     0     do_sigtime b6e61c58 S /system/bin/mm-pp-daemon

radio     400   1     15240  1172  20    0     0     0     poll_sched b6bf3b74 S /system/bin/qmuxd

system    448   310   11384  2852  20    0     0     0     sys_epoll_ b6d74984 S /system/bin/dpmd

sensors   500   1     33168  1972  20    0     0     0     poll_sched b6d1bb74 S /system/bin/sensors.qcom

radio     501   1     17636  4016  20    0     0     0     __skb_recv b6b458e8 S /system/bin/netmgrd

system    514   1     7516   2048  20    0     0     0     poll_sched b6c33b74 S /system/bin/imsdatadaemon

root      583   2     0      0     -17   0     16    1     __mdss_fb_ 00000000 D mdss_fb0

system    625   1     3136   1216  20    0     0     0     poll_sched b6efab4c S /system/bin/charger_monitor

root      685   2     0      0     0     -20   0     0     rescuer_th 00000000 S IPCRTR

root      686   2     0      0     0     -20   0     0     rescuer_th 00000000 S ipc_rtr_smd_ipc

root      1040  2     0      0     0     -20   0     0     rescuer_th 00000000 S IPCRTR

root      1049  2     0      0     0     -20   0     0     rescuer_th 00000000 S ipc_rtr_wcnss_i

system    1617  305   1770916 154264 18    -2    0     0     sys_epoll_ b6d18984 S system_server

media_rw  3154  231   23152  4244  20    0     0     0     inotify_re b6dd8960 S /system/bin/sdcard

system    3176  305   1758100 187876 19    -1    0     0     sys_epoll_ b6d18984 S com.android.systemui

system    3329  305   794656 57348 19    -1    0     0     sys_epoll_ b6d18984 S com.miui.networkassistant.deamon

system    3415  305   800188 74228 19    -1    0     0     sys_epoll_ b6d18984 S com.miui.securitycenter.remote

system    3526  305   824224 75032 19    -1    0     0     sys_epoll_ b6d18984 S com.miui.networkassistant.shadow

system    3552  305   806688 72764 19    -1    0     0     sys_epoll_ b6d18984 S com.securespaces.android.ssm.service

system    3688  305   762996 43216 19    -1    0     0     sys_epoll_ b6d18984 S com.quicinc.cne.CNEService

radio     3695  305   759060 41036 19    -1    0     0     sys_epoll_ b6d18984 S com.qualcomm.qcrilmsgtunnel

system    3724  305   778604 58660 19    -1    0     0     sys_epoll_ b6d18984 S com.miui.whetstone

radio     3765  305   820188 72600 19    -1    0     0     sys_epoll_ b6d18984 S com.android.phone

radio     3952  305   797484 60688 19    -1    0     0     sys_epoll_ b6d18984 S com.miui.voip

system    4004  305   806728 61720 19    -1    0     0     sys_epoll_ b6d18984 S com.miui.powerkeeper:service

root      4089  1     2592   988   20    0     0     0     poll_sched b6e4cb4c S /system/bin/subsystem_ramdump

system    4109  305   771008 51468 19    -1    0     0     sys_epoll_ b6d18984 S com.miui.antispam:provider

root      4707  1     5792   424   20    0     0     0     poll_sched 0002b0d4 S /sbin/adbd

system    4983  1     14088  2136  20    0     0     0     binder_thr b6e78ab0 S /system/bin/mcd

root      5062  1     8580   1148  13    -7    0     0     futex_wait b6d9763c S /system/bin/mpdecision

root      5078  2     0      0     -100  0     99    1     cpu_stoppe 00000000 S migration/3

root      5080  2     0      0     0     -20   0     0     worker_thr 00000000 S kworker/3:2H

root      5081  2     0      0     20    0     0     0     run_ksofti 00000000 S ksoftirqd/3

bluetooth 7608  305   768564 45644 19    -1    0     0     sys_epoll_ b6d18984 S com.android.bluetooth

system    9963  305   797436 48616 19    -1    0     0     sys_epoll_ b6d18984 S com.miui.bugreport:remote

root      13325 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/u:4

root      14779 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/u:1

root      15216 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/u:2

root      15641 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/3:2

root      15908 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/u:3

root      16517 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/u:6

root      16912 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/0:0

root      17318 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/3:1

root      17480 2     0      0     0     -20   0     0     worker_thr 00000000 S kworker/3:0H

root      18264 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/3:0

root      18605 2     0      0     0     -20   0     0     worker_thr 00000000 S kworker/0:2H

root      18637 2     0      0     0     -20   0     0     worker_thr 00000000 S kworker/3:1H

system    19099 305   755880 38060 19    -1    0     0     sys_epoll_ b6d18984 S com.qualcomm.svi

root      19190 4707  2808   1040  20    0     0     0              0 b6d9d960 R ps

root      19209 2     0      0     -100  0     99    1     cpu_stoppe 00000000 S migration/2

root      19210 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/2:0

root      19211 2     0      0     0     -20   0     0     worker_thr 00000000 S kworker/2:0H

root      19212 2     0      0     20    0     0     0     run_ksofti 00000000 S ksoftirqd/2

root      19213 2     0      0     -100  0     99    1     cpu_stoppe 00000000 S migration/1

root      19214 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/1:0

root      19215 2     0      0     0     -20   0     0     worker_thr 00000000 S kworker/1:0H

root      19216 2     0      0     20    0     0     0     run_ksofti 00000000 S ksoftirqd/1

root      19217 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/2:1

==========================================================================

其中, root      1     0     2488   780   20    0     0     0     sys_epoll_ 000710f4 S /init

对于init进程, 参考 http://www.cnblogs.com/nokiaguy/archive/2013/04/14/3020774.html 和 http://blog.csdn.net/hu3167343/article/details/38299969,

可以知道init进程是系统中的第一个用户空间进程, 主要工作职责有以下5点:

(1) 建立与内核文件(如设备驱动文件:/dev, 内存文件: /proc, /sys)相关的目录


(2) 初始化属性服务

(3) 处理配置文件的命令(主要是init.rc文件), 包括处理各种action

(4) 性能分析(使用bootchart工具)

(5) 无限循环执行command(启动其他进程, 如zygote)

其中, root      2     0     0      0     -2    0     1     1       kthreadd 00000000 S kthreadd

对于kthreadd进程, 参考 http://stackoverflow.com/questions/13390568/kernel-thread-kthreadd和 http://stackoverflow.com/questions/13390568/kernel-thread-kthreadd,

可以知道 kthreadd是守护进程, 主要是管理kworker进程(创建kworkder进程, 所以发现kworker的 parent pid都为2), 并且始终处于内核态.

可以看出有27个kworker进程 http://blog.chinaunix.net/uid-29616823-id-4470648.html 和 

root      5     2     0      0     0     -20   0     0     worker_thr 00000000 S kworker/0:0H

root      6     2     0      0     20    0     0     0     msm_mpm_wo 00000000 D kworker/u:0

root      7     2     0      0     0     -20   0     0     msm_rpm_sm 00000000 D kworker/u:0H

root      23    2     0      0     20    0     0     0     worker_thr 00000000 S kworker/0:1

root      27    2     0      0     0     -20   0     0     worker_thr 00000000 S kworker/0:1H

root      33    2     0      0     0     -20   0     0     worker_thr 00000000 S kworker/u:1H

root      216   2     0      0     20    0     0     0     worker_thr 00000000 S kworker/0:3

root      217   2     0      0     20    0     0     0     worker_thr 00000000 S kworker/0:4

root      394   2     0      0     20    0     0     0     worker_thr 00000000 S kworker/u:5

root      5080  2     0      0     0     -20   0     0     worker_thr 00000000 S kworker/3:2H

root      13325 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/u:4

root      14779 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/u:1

root      15216 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/u:2

root      15641 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/3:2

root      15908 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/u:3

root      16517 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/u:6

root      16912 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/0:0

root      17318 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/3:1

root      17480 2     0      0     0     -20   0     0     worker_thr 00000000 S kworker/3:0H

root      18264 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/3:0

root      18605 2     0      0     0     -20   0     0     worker_thr 00000000 S kworker/0:2H

root      18637 2     0      0     0     -20   0     0     worker_thr 00000000 S kworker/3:1H

root      19210 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/2:0

root      19211 2     0      0     0     -20   0     0     worker_thr 00000000 S kworker/2:0H

root      19214 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/1:0

root      19215 2     0      0     0     -20   0     0     worker_thr 00000000 S kworker/1:0H

root      19217 2     0      0     20    0     0     0     worker_thr 00000000 S kworker/2:1

参考: http://askubuntu.com/questions/33640/kworker-what-is-it-and-why-is-it-hogging-so-much-cpu, 可以知道kworker的字面意思就是 kernel worker, 及linux系统的内核工作进程, 负责中断处理, 定时器, I/O等工作, kworkder后面的数字表明自己运行在哪个CPU的哪个核上.

出现了32个irq进程, 如下;

root      56    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/99-msm_iomm

root      57    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/105-msm_iom

root      58    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/77-msm_iomm

root      59    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/70-msm_iomm

root      60    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/94-msm_iomm

root      61    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/102-msm_iom

root      62    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/102-msm_iom

root      63    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/102-msm_iom

root      64    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/79-msm_iomm

root      65    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/78-msm_iomm

root      66    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/78-msm_iomm

root      67    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/74-msm_iomm

root      68    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/75-msm_iomm

root      69    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/75-msm_iomm

root      70    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/75-msm_iomm

root      71    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/75-msm_iomm

root      72    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/273-msm_iom

root      73    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/273-msm_iom

root      74    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/273-msm_iom

root      75    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/97-msm_iomm

root      76    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/97-msm_iomm

root      77    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/97-msm_iomm

root      93    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/475-adsp

root      94    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/411-mba

root      95    2     0      0     -51   0     50    1     irq_thread 00000000 S irq/539-wcnss

root      164   2     0      0     -51   0     50    1     irq_thread 00000000 S irq/170-msm_sdc

root      165   2     0      0     -51   0     50    1     irq_thread 00000000 S irq/253-msm_sdc

root      187   2     0      0     -51   0     50    1     irq_thread 00000000 S irq/195-ngd_sli

root      195   2     0      0     -51   0     50    1     irq_thread 00000000 S irq/299-bsi-bat

root      196   2     0      0     -51   0     50    1     irq_thread 00000000 S irq/344-atmel_m

root      279   2     0      0     -51   0     50    1     irq_thread 00000000 S irq/288-wcd9xxx

root      366   2     0      0     -51   0     50    1     irq_thread 00000000 S irq/33-cpubw_hw

参考: https://fypandroid.wordpress.com/2011/02/10/interrupt-requests-irqs/, 可以知道, irq: Interrupt Requesting, 即终端处理程序, 负责各种终端任务的处理工作, 来实现系统的多任务处理. 至于irq后面字符的意义, 就要查询代码了.

出现了4个ksoftirqd进程:

root      3     2     0      0     20    0     0     0     run_ksofti 00000000 S ksoftirqd/0

root      5081  2     0      0     20    0     0     0     run_ksofti 00000000 S ksoftirqd/3

root      19212 2     0      0     20    0     0     0     run_ksofti 00000000 S ksoftirqd/2

root      19216 2     0      0     20    0     0     0     run_ksofti 00000000 S ksoftirqd/1

参考 http://baike.baidu.com/link?url=LhgCGu2olaNTEDALt6pYw5a5M6b0LE-rbp3ok0u_LM0ZfOWgGPubJX1enqyctKoL_S5ttMazcfPjle7rmdbnza, 

可以知道软中断与函数调用的主要区别在于:

软中断是linux系统原“底半处理”的升级,在原有的基础上发展的新的处理方式,以适应多cpu 、多线程的软中断处理。

软中断是实现系统API函数调用的手段

函数调用时将返回地址和CPU状态寄存器内容压栈,函数执行完毕后出栈返回断点继续执行。

软中断调用时将返回地址和CPU状态寄存器内容压栈,修改特权级,根据中断号查找中断向量表,找到ISR中断服务例程地址,跳转执行。

综上,函数调用和软中断调用的区别是,软中断多了修改特权级和查找中断向量表的功能,其他部分完全一样。


出现了4个migration进程:

root      8     2     0      0     -100  0     99    1     cpu_stoppe 00000000 S migration/0

root      5078  2     0      0     -100  0     99    1     cpu_stoppe 00000000 S migration/3

root      19209 2     0      0     -100  0     99    1     cpu_stoppe 00000000 S migration/2

root      19213 2     0      0     -100  0     99    1     cpu_stoppe 00000000 S migration/1

参考 http://superuser.com/questions/440906/what-is-the-migration-process,

可以知道 migration (移民) 进程主要作用就是在CPU核上移动任务作为负载均衡(每个核心上至少有1个migration进程), 它是 kernel process.

其中, root      21    2     0      0     0     -20   0     0     rescuer_th 00000000 S khelper

根据下列内核代码可以知道

/* This is run by khelper thread  */
static void __call_usermodehelper(struct work_struct *work)
{
struct subprocess_info *sub_info =
container_of(work, struct subprocess_info, work);
int wait = sub_info->wait & ~UMH_KILLABLE;
pid_t pid;

/* CLONE_VFORK: wait until the usermode helper has execve'd
* successfully We need the data structures to stay around
* until that is done.  */
if (wait == UMH_WAIT_PROC)
pid = kernel_thread(wait_for_helper, sub_info,
CLONE_FS | CLONE_FILES | SIGCHLD);
else
pid = kernel_thread(____call_usermodehelper, sub_info,
CLONE_VFORK | SIGCHLD);

switch (wait) {
case UMH_NO_WAIT:
call_usermodehelper_freeinfo(sub_info);
break;

case UMH_WAIT_PROC:
if (pid > 0)
break;
/* FALLTHROUGH */
case UMH_WAIT_EXEC:
if (pid < 0)
sub_info->retval = pid;
umh_complete(sub_info);
}
}

khelper进程主要是kernel进程与userspace进程交互的辅助进程.

其中, root      305   1     1537176 67416 20    0     0     0     poll_sched b6d18b4c S zygote

参考 http://blog.csdn.net/luoshengyang/article/details/6768304,

可以知道zygote进程主要功能如下;

        1. 系统启动时init进程会创建Zygote进程,Zygote进程负责后续Android应用程序框架层的其它进程的创建和启动工作。

        2. Zygote进程会首先创建一个SystemServer进程,SystemServer进程负责启动系统的关键服务,如包管理服务PackageManagerService和应用程序组件管理服务ActivityManagerService。

        3. 当我们需要启动一个Android应用程序时,ActivityManagerService会通过Socket进程间通信机制,通知Zygote进程为这个应用程序创建一个新的进程。

参考资料:

整理Android手机,核心进程和线程情况: http://gityuan.com/2015/12/19/android-process-category/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android 进程管理