6

I have a process in a Linux installation that at some point has some kind of spike and passes the max allowed number of threads/processes allowed by the system. I found this by checking ps -elfT | wc -l repeatedly.

But what I don't know is what exactly is it that causes this spike.
The output of ps -elfT has a lot of information, but I cannot easily understand if there is some child process that does some kind of "blurp" in forking and makes a mess.

How could I figure that out?

Example: ps -elfT | cut -d' ' -f3 | sort |uniq gives me the processes running at the time. How could I add a count to see how much each contributes to the total?

1 Answer 1

7
ps -eo nlwp,pid,args --sort nlwp 

Would show a list of processes sorted by their number of threads.

For a top-like view of that, you can always do:

watch -n 1 'ps -eo nlwp,pid,args --sort -nlwp | head' 

Or you could use... top.

  • press f to select the fields to display.
  • locate nTH (the number of threads) and press d to display it and s to make it the sort order
  • you can adjust its display position with and then and and .
  • q to get back to the process list
  • press H if you want to see all the threads.
  • d to adjust the delay.
  • ? for help.
3
  • Would I see for all users? And also would that show also threads like with the T in the command in my post? Commented Dec 13, 2017 at 20:36
  • How can I view this information constantly instead of running it constanly? I.e. keep it refreshing like top? Commented Dec 13, 2017 at 21:29
  • @Jim, see edit. Commented Dec 13, 2017 at 22:27

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.