Ubuntu 14.04 32bit
先直观地认识一下
ps -eo pid,comm,cmd
PID COMMAND CMD 1 init /sbin/init 2 kthreadd [kthreadd] 3 ksoftirqd/0 [ksoftirqd/0] 5 kworker/0:0H [kworker/0:0H] 7 rcu_sched [rcu_sched] 8 rcu_bh [rcu_bh] 9 migration/0 [migration/0] 10 watchdog/0 [watchdog/0] 11 watchdog/1 [watchdog/1] 12 migration/1 [migration/1] 13 ksoftirqd/1 [ksoftirqd/1] 15 kworker/1:0H [kworker/1:0H] 16 khelper [khelper] 17 kdevtmpfs [kdevtmpfs] 18 netns [netns] 19 writeback [writeback] 20 kintegrityd [kintegrityd] 21 bioset [bioset] 23 kblockd [kblockd] 24 ata_sff [ata_sff] 25 khubd [khubd] 26 md [md] 27 devfreq_wq [devfreq_wq] 30 khungtaskd [khungtaskd] 31 kswapd0 [kswapd0] 32 ksmd [ksmd] 33 khugepaged [khugepaged] 34 fsnotify_mark [fsnotify_mark] 35 ecryptfs-kthrea [ecryptfs-kthrea] 36 crypto [crypto] 48 kthrotld [kthrotld] 50 scsi_eh_0 [scsi_eh_0] 51 scsi_eh_1 [scsi_eh_1] 52 scsi_eh_2 [scsi_eh_2] 53 scsi_eh_3 [scsi_eh_3] 77 deferwq [deferwq] 78 charger_manager [charger_manager] 127 kpsmoused [kpsmoused] 136 jbd2/sda8-8 [jbd2/sda8-8] 137 ext4-rsv-conver [ext4-rsv-conver] 266 upstart-udev-br upstart-udev-bridge --daemon 272 systemd-udevd /lib/systemd/systemd-udevd --daemon 378 kvm-irqfd-clean [kvm-irqfd-clean] 391 hd-audio0 [hd-audio0] 438 upstart-socket- upstart-socket-bridge --daemon 536 jbd2/sda1-8 [jbd2/sda1-8] 537 ext4-rsv-conver [ext4-rsv-conver] 544 jbd2/sda6-8 [jbd2/sda6-8] 545 ext4-rsv-conver [ext4-rsv-conver] 549 jbd2/sda7-8 [jbd2/sda7-8] 550 ext4-rsv-conver [ext4-rsv-conver]
....
30017 kworker/0:2 [kworker/0:2] 30688 gvfsd-recent /usr/lib/gvfs/gvfsd-recent --spawner :1.11 /org/gtk/gvfs/exec_spaw/2
第三列中中括号包裹的命令,对应的进程是内核线程。
内核线程是一种特权进程,有如下特点:
1. 以内核态运行在内核地址空间
2. 不与用户直接交互,因此不需要终端设备
3. 在系统启动时创建,然后一直处于活跃的状态直到系统关闭
注:这些个内核线程对应的proc/$pid/maps文件都是空的...