Stop wondering why your process has a million threads
Process & Resource Monitoring (Top/Htop/Ps/Systemd)
Stop wondering why your process has a million threads
🧩 The Challenge
You look at top and see a process chewing through 400 percent CPU, but you can’t tell if it’s one runaway loop or a thread explosion. I’ve wasted way too much time staring at process lists trying to count threads by hand.
💡 The Fix
Just add the thread count column to ps or let top do the heavy lifting for you. It saves you from guessing if the app is leaking threads or just spinning its wheels.
ps -e -o pid,nlwp,cmd --sort=-nlwp
or just hit "H" inside top to toggle thread view
⚙️ Why It Works
Adding nlwp—which stands for number of lightweight processes—to your ps output gives you the exact thread count instantly. Viewing this sorted by the highest number makes it painfully obvious when a process is spawning hundreds of threads like a gremlin.
🚀 Pro-Tip: If you’re using htop, hit F2 for setup, go to Columns, and add NLWP to your display permanently.
Linux Tips & Tricks | © ngelinux.com | 9/27/2026
