Sample Header Ad - 728x90

Get PID from TID

12 votes
1 answer
10190 views
I run [iotop](http://guichaz.free.fr/iotop/) to check on programs that are heavy disk users, in case I need to decrease their priority. Usually this is good enough, but iotop only shows thread ID (TID), and sometimes I want to know process ID (PID) so I can find out more about which process is responsible. Unfortunately, while ps can display TID (a.k.a SPID, LWP), it doesn't have a flag to take a list of TIDs the way it does for a list of PIDs with --pid. The best I can do is list TIDs and then grep the output. For example, if the thread id is 792, I can do $ ps -eLf | grep ' 792 ' which works reasonably well, but is a little inelegant. Is there a better way?
Asked by Nathaniel M. Beaver (1398 rep)
Mar 15, 2018, 04:35 PM
Last activity: Dec 18, 2024, 06:00 AM