Results 1 to 4 of 4
To see if an application is using all the cores in a system, I wanted to identify which process is running on a core at a given time. Is there ...
- 06-11-2010 #1Just Joined!
- Join Date
- Jun 2010
- Posts
- 3
Identify a process id on a cpu core
To see if an application is using all the cores in a system, I wanted to identify which process is running on a core at a given time. Is there any way to get that information? Thanks!!
-H
- 06-12-2010 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
The scheduler can move a process or thread from core to core many thousands (or millions) of times a second. The best way (or at least a simple way - best is a matter of opinion) to check if your cores are being utilized well is to run the 'top' command and then press the key '1' (number one on top row of keyboard) to show how the cores are being utilized.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 06-12-2010 #3Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
As far as telling which core a process or thread is running on, there are C language functions that can do that, but you would have to program the use of them into your applications directly. I don't know off-hand if there is a tool to tell what cpu an program may be assigned to, due to the scheduling behavior I mentioned previously.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 06-12-2010 #4
Alternative to top and pressing "1", you could install and use htop, which has a nice and even coloured output of load per core.
As rubberman explained, the scheduler can reassign processes as it sees fit.
However, if you know better, there is a tool to assign tasks to certain cores or even one core:
"taskset", which can be found in the "schedutils" packageYou must always face the curtain with a bow.


Reply With Quote