Linux processes have been running for a long time. In addition to reading/proc information, how can we get the number of all threads of a process and their startup time.
Ps max-o lstart, lwp, pid, nlwp, cmd
Lstart STARTED time the command started.
Nlwp NLWP number of lwps (threads) in the process. (alias thcount ).
Lwp LWP lwp (light weight process, or thread) ID of the lwp being reported.
(Alias spid, tid ).
BONO11-0-0-1:/root-# ps max-o % mem, lstart, lwp, pid, nlwp, cmd
% MEM STARTED LWP PID NLWP CMD
0.0 Fri Nov 11 13:25:29 2011-1 1 init [3]
-Fri Nov 11 13:25:29 2011 1 ---
0.0 Fri Nov 11 13:25:29 2011-2 1 [migration/0]
-Fri Nov 11 13:25:29 2011 2 ---
0.0 Fri Nov 11 13:25:29 2011-3 1 [ksoftirqd/0]
-Fri Nov 11 13:25:29 2011 3 ---
...
0.0 Fri Nov 11 13:50:46 2011-31012 8/opt/proxy/bin/http_stack Http Stack benchHttp _ asr_1_h-Fri Nov 11 13:50:46 2011 31012 ---
-Fri Nov 11 13:50:46 2011 31016 ---
-Fri Nov 11 13:50:46 2011 31018 ---
-Fri Nov 11 13:50:46 2011 31019 ---
-Fri Nov 11 13:50:47 2011 31855 ---
-Fri Nov 11 13:50:47 2011 31856 ---
-Fri Nov 11 13:50:47 2011 31857 ---
-Fri Nov 11 13:50:47 2011 31926 ---
0.0 Fri Nov 11 17:14:19 2011-31272 1 sshd: root @ notty
-Fri Nov 11 17:14:19 2011 31272 ---
We can verify that there are exactly eight tasks.
BONO11-0-0-1:/root-# ls/proc/31012/task/
31012 31016 31018 31019 31855 31856 31857
From licanhua's column