* how to know which cpu current process run
@ 2013-08-15 12:24 loody
2013-08-15 12:57 ` Valdis.Kletnieks at vt.edu
0 siblings, 1 reply; 3+ messages in thread
From: loody @ 2013-08-15 12:24 UTC (permalink / raw)
To: kernelnewbies
hi all:
is there any shell command or tool can let me know which cpu current
process run on?
--
Thanks for your help
^ permalink raw reply [flat|nested] 3+ messages in thread
* how to know which cpu current process run
2013-08-15 12:24 how to know which cpu current process run loody
@ 2013-08-15 12:57 ` Valdis.Kletnieks at vt.edu
2013-08-15 13:28 ` loody
0 siblings, 1 reply; 3+ messages in thread
From: Valdis.Kletnieks at vt.edu @ 2013-08-15 12:57 UTC (permalink / raw)
To: kernelnewbies
On Thu, 15 Aug 2013 20:24:21 +0800, loody said:
> is there any shell command or tool can let me know which cpu current
> process run on?
Why are you trying to check from the shell? What problem are you
trying to solve by knowing which CPU?
(The problem is that it's inherently *very* racy - the process could easily
get bounced across 2 or 3 different CPUs in the amount of time it takes
a shell command to check - and on large SGI UV boxes under sufficient memory
thrashing, it could bounce across 50 or 60 different cores while you check).
And checking the *current* process tells you even less than "checking the
process you care about" - because unless it's a shell builtin, when you
launch the command, it will quite possibly end up on some core other than
the one the shell is running on....
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130815/ee2ccdef/attachment.bin
^ permalink raw reply [flat|nested] 3+ messages in thread
* how to know which cpu current process run
2013-08-15 12:57 ` Valdis.Kletnieks at vt.edu
@ 2013-08-15 13:28 ` loody
0 siblings, 0 replies; 3+ messages in thread
From: loody @ 2013-08-15 13:28 UTC (permalink / raw)
To: kernelnewbies
hi Valdis:
Thanks for your kind reply :)
2013/8/15 <Valdis.Kletnieks@vt.edu>:
> On Thu, 15 Aug 2013 20:24:21 +0800, loody said:
>> is there any shell command or tool can let me know which cpu current
>> process run on?
>
> Why are you trying to check from the shell? What problem are you
> trying to solve by knowing which CPU?
I adopt one sample code which uses sched_setaffinity to force user
program running on core#1, suppose my environment has core#0 and
core#1.
Theoretically, it is ONLY run on core#1.
When I use top, I cannot tell whether it runs on core#0 or core#1, so
I wrote this letter to ask help any tool checking what cpu this
program ran on.
i also attach my program for all your reference.
>And checking the *current* process tells you even less than "checking the
>process you care about" - because unless it's a shell builtin, when you
>launch the command, it will quite possibly end up on some core other than
>the one the shell is running on....
it seems I use wrong way to express what I need.
I need any tool to check whether the process I assigned to cpu with
sched_setaffinity did work.
--
Regards,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: affinity.sample.c
Type: text/x-csrc
Size: 1281 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130815/3bb168ab/attachment-0001.bin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-15 13:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-15 12:24 how to know which cpu current process run loody
2013-08-15 12:57 ` Valdis.Kletnieks at vt.edu
2013-08-15 13:28 ` loody
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.