先查出进程id,然后从下面命令行执行结果查看线程数:
cat /proc/{进程id}/status
得出结果:
···
Name: java
State: S (sleeping)
Tgid: 9420
Pid: 9420
PPid: 1
TracerPid: 0
Uid: 0 0 0 0
Gid: 0 0 0 0
Utrace: 0
FDSize: 256
Groups: 0
VmPeak: 3466204 kB
VmSize: 3452836 kB
VmLck: 0 kB
VmHWM: 619912 kB
VmRSS: 619612 kB
VmData: 3292540 kB
VmStk: 88 kB
VmExe: 4 kB
VmLib: 16744 kB
VmPTE: 1728 kB
VmSwap: 0 kB
Threads: 51
SigQ: 1/127426
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000000003
SigCgt: 2000000181005ccc
CapInh: 0000000000000000
CapPrm: ffffffffffffffff
CapEff: ffffffffffffffff
CapBnd: ffffffffffffffff
Cpus_allowed: 7fff
Cpus_allowed_list: 0-14
Mems_allowed: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
Mems_allowed_list: 0
voluntary_ctxt_switches: 5
nonvoluntary_ctxt_switches: 6
···
可以看到线程数量为51条
Threads: 51