Saturday, July 08, 2017

There are many processes in Linux which run on single core while many will switch between different core depending upon the availability.

With below two methods you can find if a process is continuously running on single core or if it is switching between all the available cores based on the availability.

Method 1
Below command can be used# ps -o pid,psr,time,comm -p $(pgrep -x fio)
PID PSR TIME COMMAND
8453 4 00:00:00 fio
8455 8 00:00:01 fio
Here 'psr' column shows the last used core by the process. I have used pgrep to grep the pid of the process running by the name of 'fio'. Everytime I hit the same command I observe the processor to be changing# ps -o pid,psr,time,comm -p $(pgrep -x fio)
PID PSR TIME COMMAND 8453 4 00:00:00 fio 8455 8 00:00:03 fio

# ps -o pid,psr,time,comm -p $(pgrep -x fio)
PID PSR TIME COMMAND
8453 9 00:00:00 fio 8455 8 00:00:03 fio
So to monitor this for a while I can run it in a while loop, here I have used a sleep of 5 seconds which you can increase based on the requirement

Recent Posts

Your browser does not support JavaScript!

ABOUT ME

My name is Deepak Prasad and I am very passionate about my work which mostly includes and revolves around Linux/Unix platform, virtualization, hardware, security, networking, scripting, automation and many other stuff.

If I look back it looks like it was just yesterday when I started as a fresher in my first company as a total noob (which still I am BTW) and now I am here trying to run a tutorial site, I am not sure how good this is but at least I feel I learn something new every time I open my blog to write a new post. This honestly was sort of a notebook for me later turned into a tutorial blog.