Maximum Number of Processor Cores in CLR (VS 2013, Server 2012) RRS feed

  • Question

  • I found another thread on this subject from 2010, but it gave the appearance of having been resolved in 2010. So, it is unclear to me why I would still be seeing my CLR programs limited to using 32 logical processors on a Windows Server 2012 with 48 logical processors.

    Forums/vstudio/en-US: "Maximum Number of Processor Cores in CLR"

    I wrote the following dumb C# program to test whether my program written in C# actually had access to all 48 logical processors, since it appeared to be more restricted in processor use than when I was running the same processing using multiple processes.

        class Program
            static void Main(string[] args)
                var threads = new Thread[100].Select(t => new Thread(() =>
                {   for (;;) Math.Max(int.MaxValue, int.MinValue); })).ToArray();
                Array.ForEach(threads, t => t.Start());


    Which produces the following Task Manager plots on our Windows Server 2012 with 2 x Intel Xeon processors with 24 cores and 48 logical processors.

    <unfortunately, not allowed to include images>

    It is pretty easy to see from the screenshot (not included) that only 32 out of 48 processors are in use by the program (at 100% utilization), resulting in around 75% processor utilization. The effect is the same with any number of threads greater than or equal to 32.

    Is there any way that I can fix this program or the system on which it is running to make user of all 48 logical processors within a single process?

    Monday, January 25, 2016 4:32 PM


  • Hi Brendanx-uw,

    >>Is there any way that I can fix this program or the system on which it is running to make user of all 48 logical processors within a single process?

    Per my understanding, to make it run faster and efficient usage of resources, you must create multiple tasks and synchronize them.

    Please take a look at the following article, this article shows the evolution of parallel programming in C# and explains how to use the new Async paradigm.

    For the sake of comparison, the author of the article creates a synchronous program that calculates the prime numbers between 2 and 10,000,000. The program shows how many prime numbers it can find and the time required to do so, please note Figure 4 and Figure 5, some sample code at GitHub.


    Hope this helps!

    Have a nice day!


    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites;Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, January 26, 2016 5:40 AM