windaoo吧 关注:12贴子:446
  • 12回复贴,共1
$ ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 Jul01 ?        00:00:07 init [2]
root         2     0  0 Jul01 ?        00:00:00 [kthreadd]
root         3     2  0 Jul01 ?        00:00:00 [migration/0]
root         4     2  0 Jul01 ?        00:00:00 [ksoftirqd/0]
root         5     2  0 Jul01 ?        00:00:00 [watchdog/0]
root         6     2  0 Jul01 ?        00:00:00 [migration/1]
root         7     2  0 Jul01 ?        00:00:00 [ksoftirqd/1]
root         8     2  0 Jul01 ?        00:00:00 [watchdog/1]
root         9     2  0 Jul01 ?        00:00:24 [events/0]
root        10     2  0 Jul01 ?        00:00:14 [events/1]
root        11     2  0 Jul01 ?        00:00:00 [khelper]
root        43     2  0 Jul01 ?        00:00:00 [kblockd/0]
root        44     2  0 Jul01 ?        00:00:00 [kblockd/1]
root        47     2  0 Jul01 ?        00:00:00 [kacpid]
root        48     2  0 Jul01 ?        00:00:00 [kacpi_notify]



IP属地:北京1楼2008-12-17 01:02回复
    root       113     2  0 Jul01 ?        00:00:00 [kseriod]
    root       154     2  0 Jul01 ?        00:00:02 [pdflush]
    root       155     2  0 Jul01 ?        00:00:00 [kswapd0]
    root       156     2  0 Jul01 ?        00:00:00 [aio/0]
    root       157     2  0 Jul01 ?        00:00:00 [aio/1]
    root       666     2  0 Jul01 ?        00:00:00 [ata/0]
    root       667     2  0 Jul01 ?        00:00:00 [ata/1]
    root       668     2  0 Jul01 ?        00:00:00 [ata_aux]
    root       683     2  0 Jul01 ?        00:00:00 [ksuspend_usbd]
    root       686     2  0 Jul01 ?        00:00:00 [khubd]
    root       817     2  0 Jul01 ?        00:00:00 [scsi_eh_0]
    root      1013     2  0 Jul01 ?        00:00:01 [kjournald]
    root      1175     1  0 Jul01 ?        00:00:00 udevd --daemon
    root      1569     2  0 Jul01 ?        00:00:00 [kpsmoused]
    root      1633     2  0 Jul01 ?        00:00:00 [kgameportd]
    


    IP属地:北京2楼2008-12-17 01:02
    回复
      话说 中括号括起来的应该就是大名鼎鼎的内核线程了
      待我 man ps


      IP属地:北京3楼2008-12-17 01:03
      回复
        man ps 无果,看来需要 google


        IP属地:北京4楼2008-12-17 01:17
        回复
          google: linux ps -ef square brackets
          -----------------
          http: //mail.nl.linux.org/kernelnewbies/2005-08/msg00229.html:
          Items in the brackets means that the proccesses/threads
          are parts of the running kernel.
          (that's the reason we cannot kill them)

          Stavros
          --------------------------------

          他说的跟我猜的一样


          IP属地:北京5楼2008-12-17 01:27
          回复
            又查种种书,google,得到这些结果:
            -----------------
            LKD2:

            内核经常需要在后台执行一些操作。这种任务可以交由内核线程完成。所谓内核线程,就是一些独立运行于内核空间的*进程*,与普通进程的区别在于内核线程没有独立的地址空间(mm == NULL),它们只在内核空间执行,可被调试和抢占。

            创建一个内核线程:

            int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)

            一般情况下,内核线程会直到系统重启才结束。


            IP属地:北京6楼2008-12-17 01:38
            回复
              LKD2:
              某些内核线程名字形如:

              name/n

              这表示,名字为 name 的线程在每个处理器上都有一个,n 是处理器的编号


              IP属地:北京7楼2008-12-17 01:41
              回复
                订正:

                它们(指内核线程)只在内核空间执行,可被调试和抢占。
                ==================
                “调试” 应为“调度”

                之所以打错是因为我的五笔输入法中:
                调试 = ymya2
                调度 = ymya3


                IP属地:北京8楼2008-12-17 01:46
                回复
                  现在拿到 name/n 类的所有内核线程,看它们到底是干嘛的:

                  windaoo@deb:~$ ps -ef | grep '\[[^ ]*/' | sed -e 's/\/.*$//g' -e 's/\[//g' | sort -uk8 | awk '{print $NF}'
                  pts
                  aio
                  ata
                  events
                  kblockd
                  ksoftirqd
                  migration
                  watchdog


                  IP属地:北京9楼2008-12-17 01:52
                  回复
                    无果。

                    睡觉,明天继续


                    IP属地:北京10楼2008-12-17 02:45
                    回复
                      孩子终于睡下了,继续


                      IP属地:北京11楼2008-12-18 00:16
                      回复
                        没找到啥系统的文章,改天有空时从 ulk3 上找找
                        现在知道的两个:
                        events:见 lkd2 中文版 87 页,是默认的“工作者线程”,用于处理 work queue 这种中断的下半部处理方式生成的任务的。
                        ksoftirqd: 见 lkd2 中文版 85 页,这些线程同样于来处理中断的下半部,与 events 不同的是它们处理的是 软中断 方式的下半部任务


                        IP属地:北京12楼2008-12-18 01:19
                        回复
                          其它的看到时候再上来更新此贴


                          IP属地:北京13楼2008-12-18 01:19
                          回复