Getting thread count for proc in linux

本文介绍了一种在Linux环境下查看每个进程线程数量的方法。使用`ps-A-mPl`命令可以获取进程及其子线程的信息,通过进一步的过滤和计数操作,如使用`grep`和`wc -l`,可以得到指定进程的线程数量。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

One of the developers at the company that I work for has asked me how to see number of threads per process. And I don't know how to do that. I'm using RedHat ES3.

I know in solaris you can see number of treads per process in top command, but linux version doesn't give this information. So my question is how to see thread count in linux?




You could probably abuse ps with some filtering...

start with 

ps -A -mPl

Then you can find the children belonging to the
PPID you're after and count them ... 




I did ps -elm|grep $pid|grep -v grep |wc -l
and it worked.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值