LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to determine the cpu number on which the process is running (https://www.linuxquestions.org/questions/linux-general-1/how-to-determine-the-cpu-number-on-which-the-process-is-running-864361/)

jeffwang66 02-22-2011 02:54 PM

How to determine the cpu number on which the process is running
 
Hi, guys:

When I fork multiple processes, is there some command or c function to see the cpu number on which the processes are running?


Thanks

kbp 02-22-2011 03:46 PM

You can see it in top -

Code:

top
f
j

.. the 'P' column will now be visible which is the processor that the task was last run on.

Please note that the task scheduler in the 2.6 series kernel will *automatically* redistribute processes in a SMP system if the cpu's are not equally loaded

cheers

jeffwang66 02-22-2011 04:16 PM

Thanks. Which argument of "top" command I need to use? Because I did not see the 'P' column.




Quote:

Originally Posted by kbp (Post 4267717)
You can see it in top -

Code:

top
f
j

.. the 'P' column will now be visible which is the processor that the task was last run on.

Please note that the task scheduler in the 2.6 series kernel will *automatically* redistribute processes in a SMP system if the cpu's are not equally loaded

cheers


smoker 02-22-2011 04:56 PM

Read the answer again - carefully.


All times are GMT -5. The time now is 10:23 AM.