开发者

Question about Environment.ProcessorCount

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


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.


It returns the number of logic processors, so 8 in your example.


If my computer had 2 processors, each with 4 cores, would Environment.ProcessorCount return 2, 4, or 8?

It returns 8, in my case anyways. (Core i7 860 cpu).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜