收集了几个 Linux 系统中,不依赖第三方工具查看进程的线程数的方法。
方法一:ps 命令

只查看线程数量:

方法二:top 命令

方法三:查看 /proc 信息
1
2
3
|
$ cat /proc/<PID>/status | grep Threads
# 或者
$ grep Threads /proc/<PID>/status
|

另一种方法:
1
|
$ ls /proc/<PID>/task | wc -l
|

参考资料
- http://ask.xmodulo.com/view-threads-process-linux.html
- https://stackoverflow.com/questions/268680/how-can-i-monitor-the-thread-count-of-a-process-on-linux
文章作者
xNathan
上次更新
2019-05-09
许可协议

本作品采用知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议进行许可。