LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   To get list of processes runing under a particular processor (https://www.linuxquestions.org/questions/linux-general-1/to-get-list-of-processes-runing-under-a-particular-processor-703827/)

kauuttt 02-11-2009 04:38 AM

To get list of processes runing under a particular processor
 
Hi,

In my system I have 4 processors, namely 0-4. If I want to know what are the processes which are running under a particular processors at a particular time frame(say processor 3)....what command I should use?

I am in a bit hurry...fast responses will be highly appreciable

-kd

rylan76 02-11-2009 05:25 AM

Not sure if that's possible under my 2.6.18.1 kernel processes are constantly migrating from cpu to cpu as the system sees fit.

kauuttt 02-11-2009 05:43 AM

Thats true...and thats wht I want the various processes running at a particular time frame on a particular processor....

How u are checking the CPU to CPU migration of processes?
Even knowing the PID of the processes under one particular CPU will also serve my purpose.

rylan76 02-11-2009 08:46 AM

Quote:

Originally Posted by kauuttt (Post 3439469)
Thats true...and thats wht I want the various processes running at a particular time frame on a particular processor....

How u are checking the CPU to CPU migration of processes?

On my old Fedora Core 6 install (removed it Saturday to install Fedora Core 10) I had a GTK app called GKrellM - it was a system monitor applet that would show me which CPU was most heavily loaded. Examining this graph and starting up a raytracing process (Povray) you could clearly see the povray process migrate back and forth between my two cores. BTW I do not have multiple CPUs, I have an old HT P4... don't know if this might be relevant, the fact that I have two "hyper threads" not real, physically seperate CPUs.

Plus, on my system, if you go into top, you can see that there is a seperate "migration" thread running all the time.

Quote:

Even knowing the PID of the processes under one particular CPU will also serve my purpose.
As far as I know PID for a process will stay the same across CPUs...? I. e. PID itself won't help you know which CPU is running a particular process.

Maybe you can check out the "top" binary or gnutools where top is located (I think) - my older "top" on FC6 used to show, at the top, a summary for each "cpu" (hyperthread, in my case) and if I remember right there was a way to, for example, show all processes on a certain "cpu" (hyperthread). This might help you partway... but I've got no idea (programming wise) how top did this (i. e. select processes-per-cpu).

kauuttt 02-11-2009 11:19 PM

Thanks....any other suggestions???

rylan76 02-12-2009 05:26 AM

The best I can think of is to post on a Linux kernel specific forum / group or site... You seem to need some input from somebody who intimately know the kernel and the way it switches userspace tasks around from CPU to CPU. I'm pretty sure there's a way to do what you want, but it requires some really low-level and specialised knowledge of the Linux kernel.

syg00 02-12-2009 06:04 PM

From your (now closed) duplicate thread ...
Quote:

Actaully after using 'sar' command My 1 CPU is showing 100% usage...I want to know what are the processes that are responsible for this 100%...

From top I can see that one of my process is taking 110% CPU (But not sure which CPU)...Thats why need to know the current processes runing under a particular CPU..
From the 'top' command I can easily get the last CPU used by the process...but that will help out...

Moreover is there any way by which I can know the CPU usage of threads of a particular process.As I am getting 110% CPU usage of 1 process...I need to know which threads of this process are taking more CPU....
I see no reason why you think you need to know what is actually running at any point in time on CPU1 - and it may change before you can see anyway. Run top and enter "H" (capital) to see thread view. Should enable you to determine if you have a thread running wild - much more likely to be of interest.

kauuttt 02-13-2009 12:55 AM

Quote:

Originally Posted by syg00 (Post 3441650)
I see no reason why you think you need to know what is actually running at any point in time on CPU1 and it may change before you can see anyway.

'syg00' thanks for ur suggestion !!
But I need this thing because I need to confirm which process (leaving the one which is taking 110%) are chewing up the CPU..So I need it to know the process runing for a CPU in a particular time frame..if it change also it doesn't matter to me...as I will be motinering the all CPUs which will be having 100%..

Quote:

Originally Posted by syg00 (Post 3441650)
Run top and enter "H" (capital) to see thread view. Should enable you to determine if you have a thread running wild - much more likely to be of interest.

This one is helpfull generally..I tried it before. But I am having some issues with this..
Let me say that assume process A is taking 110% CPU...when 'on' the thread option (Typing H)...I can see the threds names as also 'A'..I mean after 'H' the process A is divided among 6-7 'A' showing different usage...But I am not able to see the exact names...maybe I need to do something while building the process...

And after typing 'H' it shows the output for 2-3 secs..how can I make it in interactive mode..

-kd

mbostwick 02-18-2009 11:36 AM

htop?
 
Ever looked at htop ?


All times are GMT -5. The time now is 08:17 AM.