• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

How can one find out that a process (or one of its threads) is running on a specific processor in a multiprocessor machine.

Lets assume, I am working on a multiprocessor machine, which I am.

I use,
    Process.GetCurrentProcess().Affinity = 2; //Or something similar to this.
Now, All I need to know how would I be able to identify programatically that this process would be running on the 2nd CPU.

Given that, I can use a ManagementObject with Win32_Processor.DeviceID, how would one prove (programatically) that a particular process or one of its threads is defintely running on an assigned processor. Are there any alternatives other than ManagementObject class?
1 Solution
Well, in a multi-processor environment, generally a process is running on BOTH CPU's, just not at the same time.  Open up your task manager and run an application and look at the CPU Usage History graphs for both CPU's.  They will both be spiking around, just not at the same time.

So, I guess what I'm saying, is that there really isn't a way (at least that I can even remotely start to imagine) to do this.

Just out of curiosity, can I ask what you need this information for?


Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now