Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • 18
    That's so beautifully simple I'm almost shedding tears. Thx for the reply! Commented Oct 9, 2009 at 10:43
  • 81
    This gives the number of logical processors, not the number of cores. Commented Apr 19, 2010 at 20:23
  • 10
    @KevinKibler From the question, I suspect the OP doesn't understand the difference, and if you don't know the difference this is probably what you want. Commented Jun 15, 2014 at 15:45
  • 1
    This also returns the wrong count on many core systems. I'm running two dodeca core processors with hyper-threading, which gives me a total of 48 logical processors. Environment.ProcessorCount yields 32. Commented Aug 30, 2015 at 2:53
  • 1
    @AlexanderMorou, yes this will fail to provide accurate results on some multi CPU servers. There is a fix for this, but havent tested it yet. Commented Jun 23, 2017 at 9:43