-1

As you may know, in Linux, each CPU core has its own run queue. How can I get the number of threads currently running on each core in Linux (Ubuntu)?

3
  • 2
    You can see them by installing htop, selecting Setup and then using the arrows to select columns and then pressing the right arrow twice and selecting Processor. Press F10 and it brings you back to the list of running processes and you can see which task is running on which core. I don't know of a way to get that in numeric total form, so this isn't an answer to your question. – KGIII Sep 4 '20 at 21:52
  • @KGIII Thanks, I want the number of running threads per core. – Michel Gokan Khan Sep 5 '20 at 8:18
  • I asked a related question here: unix.stackexchange.com/questions/607892/… – Michel Gokan Khan Sep 5 '20 at 17:21
-1

As you may know, in Linux, each CPU core has its own run queue.

As I may know... this depends on some kernel tuneables. And generally untrue between siblings.

Anyway, I think that /proc/stat can give an answer to your question, man proc for an accurate definition of the fields.

You may need to fiddle some script to get the number of currently running as if I recall, stat keeps data since boottime.

1
  • /proc/stat returns total processes, and it doesn't report per core threads. – Michel Gokan Khan Sep 5 '20 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.