Use htop to determine which processor a process is loaded

Running Linux on virtual machines makes life so much easier when it comes to adding virtual hardware to a vm.  In one case, I added 4 CPUs to a virtual machine, and wondered if I needed to restart the applications to utilize the newly added CPUs.

htop is an interactive system-monitor process-viewer and process-manager. It is designed as an alternative to the Unix program top. It shows a frequently updated list of the processes running on a computer, normally ordered by the amount of CPU usage.

Problem

I wanted to know what processor the application was running on.  Since I use htop, I wanted to see if that was possible.

Solution

  • run htop
  • Hit F2 to get into the setup window
  • select Columns in the Setup column
  • go Available Columns
  • add PROCESSOR

Result

Note that there is an additional column, CPU and that the CPU 1 and CPU 2 are in use.

Source(s)

  • https://superuser.com/questions/191092/is-there-a-command-in-linux-to-know-the-processor-number-in-which-a-process-is-l
  • https://en.wikipedia.org/wiki/Htop