pid stat

在proc文件系統中有對每個進程維護一個目錄/proc/$PID/,其中的/proc/$PID/stat文件展示了該process的狀態

[root@sean ~]# cat /proc/7021/stat 7021 (gnome-session) S 6903 6874 6229 0 -1 4202752 3672 16747 60 30 6 3 14 5 20 0 2 0 3833 251568128 1572 18446744073709551615 4194304 4411596 140734229412352 140734229411488 265399685603 0 0 4100 83707 18446744073709551615 0 0 17 0 0 0 123 0 0 6508752 6536912 6537216 [root@vt-nhm9 ~]# uname -a Linux vt-nhm9 3.4.0-rc4+ #1 SMP Thu May 3 14:53:37 CST 2012 x86_64 x86_64 x86_64 GNU/Linux

對/proc/$PID/stat的解釋如下:(在最新的Linux kernel 3.4.0,在2.6.32中也是類似的) 第1列 表示進程的PID 第2列 表示進程的名稱 第3列 表示進程的狀態 (這裡的S表示Sleep,關於進程的狀態,可以後續再來篇博客介紹一下) 第4列 表示進程的PPID,即父進程的PID …… 第18列 表示進程的優先級 第19列 表示進程的nice值 第20列 表示進程的線程數量 第21列 (已被硬編碼為0) The time in jiffies before the next SIGALRM is sent to the process due to an interval timer. 第22列 表示進程的啟動時間,這個時間是用jiffies表示的從系統啟動到進程啟動的時間。The time in jiffies the process started after system boot.

Last updated

Was this helpful?