linux 查看线程信息

在linux操作系统中可以使用ps -eLf命令来查看线程信息:

下面的数据为db2数据库的db2sysc进程中所包括的线程:

192.168.100.228 [sde ~]$ ps -eLf |grep db2sysc|grep -v grep

UID        PID  PPID   LWP  C NLWP STIME TTY          TIME
 CMD
db2inst1  4865  4863  4865  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  4869  0   40  2010 ?        00:00:45 db2sysc 0
db2inst1  4865  4863  4870  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  4871  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  4872  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  4873  0   40  2010 ?        00:00:03 db2sysc 0
db2inst1  4865  4863  4874  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  4875  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  4876  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  4877  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  4878  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  5156  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  5662  0   40  2010 ?        00:00:09 db2sysc 0
db2inst1  4865  4863  5663  0   40  2010 ?        00:00:15 db2sysc 0
db2inst1  4865  4863  6125  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  6126  0   40  2010 ?        00:00:01 db2sysc 0
db2inst1  4865  4863  6127  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  6128  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  6129  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  6130  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  6131  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  6132  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  6133  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  6134  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  6135  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  6136  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  6137  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  6191  0   40  2010 ?        00:00:06 db2sysc 0
db2inst1  4865  4863  6205  0   40  2010 ?        00:00:10 db2sysc 0
db2inst1  4865  4863  6337  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  7131  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863  7578  0   40  2010 ?        00:00:13 db2sysc 0
db2inst1  4865  4863  7596  0   40  2010 ?        00:00:07 db2sysc 0
db2inst1  4865  4863  7622  0   40  2010 ?        00:00:01 db2sysc 0
db2inst1  4865  4863  7908  0   40  2010 ?        00:00:00 db2sysc 0
db2inst1  4865  4863 10637  0   40  2010 ?        00:00:02 db2sysc 0
db2inst1  4865  4863 25427  0   40 Jan04 ?        00:00:04 db2sysc 0
db2inst1  4865  4863 27917  0   40 Jan04 ?        00:00:00 db2sysc 0
db2inst1  4865  4863 30815  0   40 Jan04 ?        00:00:00 db2sysc 0
db2inst1  4865  4863 30816  0   40 Jan04 ?        00:00:00 db2sysc 0

其中

UID为User ID.

PID为process id,进程标识符

PPID为 parent process id,父进程标识符2,

LWP为light weight process or thread, 轻量级进程,即线程标识符

NLWP为,number of lwps(threads) in the process, 线程的数量

现在的db2sysc进程一共包含40个线程,它们的线程号为:

192.168.100.228 [sde ~]$ ps -eLf |grep db2sysc|grep -v grep|awk '{print $4}'
4865
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
5156
5662
5663
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6191
6205
6337
7131
7578
7596
7622
7908
10637
25427
27917
30815
30816

利用数据库的命令可以查看到更详细的线程信息:

192.168.100.228 [sde ~]$ db2pd -edus|awk '{print $3,$4}'
 
0 --
 
all
 EDUs
 
4865
4863
4880
 
TID Kernel
 
30816 db2agntdp
30815 db2agntdp
27917 db2agntdp
25427 db2agntdp
10637 db2agntdp
7908 db2agent
7622 db2agent
7596 db2agent
7578 db2agent
7131 db2agent
6337 db2agent
6205 db2agent
6191 db2agntdp
6137 db2evmgi
6136 db2fw1
6135 db2fw0
6134 db2lused
6133 db2wlmd
6132 db2pfchr
6131 db2pfchr
6130 db2pfchr
6129 db2pclnr
6128 db2dlock
6127 db2lfr
6126 db2loggw
6125 db2loggr
5663 db2stmm
5662 db2agent
5156 db2taskd
4878 db2spmlw
4877 db2spmrsy
4876 db2resync
4875 db2tcpcm
4874 db2tcpcm
4873 db2ipccm
4872 db2licc
4871 db2thcln
4870 db2alarm
4869 db2sysc

你可能感兴趣的:(thread,linux,数据库,db2,user,2010)