Determine which CPU a process is running on

Requested in 2005:

I am very impressed with the features integrated in Process Explorer but would like to see an option to display each process CPU affinity in the main window as a column toggle.

No response.

Requested in 2007:

Thanks for superb utilities. My request is to add a column option to process explorer to display CPU affinity. That's it.

No response.

Similar discussed in 2013:

It would be really nice if there were a new Process Performance View Column called Core Usage that would show a sum of the usage over the core that the process is running on.

Basic synopsis: It can't be done.

Threads are what are sent to cores for processing, not processes. Most modern processes have multiple threads.

If you manually set the affinity for a process, then all threads for the process should stick to a single processor. Since you manually set it, you should know which CPU it's on. ;)

But if you don't specify, then the thread(s) will be controlled by the OS and underlying processing hardware, and would jump around between processors at a speed that would be unwatchable, and very likely inaccurate by the time it was displayed to you.

Perhaps check out these SU question for more:

  • How does a process "pick" which core to run on?
  • What are threads, and what do they do in the processor?

Also, from StackOverflow:

  • What is the difference between a process and a thread?

Now if you wrote the program, you could use the GetCurrentProcessorNumber, which reports the current processor in use by the thread from which the function was called.

Using this will allow you to make estimations about processor usage by your threads, as you can never be sure where the threads will be one cycle to the next (again, unless you set the affinity on purpose).

More info:

  • Determine on which physical processor my code is currently running
  • Identify processor (core) is used by specific thread

This can be done by capturing a xperf trace and opening it with Windows Performance Analyzer (WPA.exe) from the Windows Performance Toolkit, here you can add a column CPU to see which CPU (Core) the process is running:

enter image description here