how to print all the processes listed on one particular core of the Processor in Linux?
I would like to write a small program which will ask me the core(or CPU) number and would list out all the currently executing processes on that particular entered core.
for example,
output would be something like this,
Enter开发者_运维百科 the CPU(or Core) Number : 1
process 1, process 2, process 3, ...... So On.
Enter the CPU(or Core) Number : 2 or any valid core number
process 1, process 2, process 3, ...... So On.
The following article talks about the CPU utilities in linux
http://www.cyberciti.biz/tips/how-do-i-find-out-linux-cpu-utilization.html
For your case I believe you might try taskset like
# taskset -p <PID>
This may be useful to find the affinity of a particular process to the CPU.
There is this other article on csets (groups of CPUs for specific applications/processes) which is a little more organized than taskset - https://rt.wiki.kernel.org/index.php/Cpuset_management_utility/tutorial
Unless otherwise specified, the kernel will dispatch timeslices of each process/thread to whichever core is currently available.
i.e. any results you could get are immediately obsolete.
精彩评论