Search code examples
c#processor

Is the processorid per core?


Can a processor whether a dual core or i3 or i5 or i7 have a processor id equals to number of core processor or number of logical processor?

I am using win32_processor to get processorid.

It returs a processorid but i am in stuck that whether it returns multiple processorid for each core processor or logical processor.

OR, it just return a processor id regardless of number of core processor and logical processor.


Solution

  • You will need to test this on your system as it depends on the type of CPU you have. It's likely to be one entry per logical (hyper-threaded) processor.

    Here is what msdn says

    On a multiprocessor computer, one instance of the Win32_Processor class exists for each processor.

    To determine the total number of processor instances associated with a computer system object, use the Win32_ComputerSystemProcessor association class.

    To determine if hyperthreading is enabled for the processor, compare NumberOfLogicalProcessors and NumberOfCores. If hyperthreading is enabled in the BIOS for the processor, then NumberOfCores is less than NumberOfLogicalProcessors. For example, a dual-processor system that contains two processors enabled for hyperthreading can run four threads or programs[ or simultaneously]. In this case, NumberOfCores is 2 and NumberOfLogicalProcessors is 4.