Reputation: 19492
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.
Upvotes: 2
Views: 376
Reputation: 61
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
Upvotes: 1
Reputation: 33435
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.
Upvotes: 0