Question about Environment.ProcessorCount

.net, c#, multithreading

Solution

It will return the NUMBER_OF_PROCESSORS environment variable. (see MSDN)

This will equal the number of logical cores - i.e. if you have a HT enabled single core processor, it will return 2.

In your case, it should return 8.

It will be the same number as the number of CPU utilization graphs you will see in task manager.

Problem

I am curious as to what the .NET property `Environment.ProcessorCount` actually returns. Does it return the number of cores, the number of processors or both? If my computer had 2 processors, each with 4 cores, would `Environment.ProcessorCount` return 2, 4, or 8?

Original source

Related problems