locked
In the Windows Server 2008 R2 Enterprise, are there any restrictions for the CPU usage of the process ? RRS feed

  • General discussion

  • Hello! I have the follow question to ask.

    In the operate system ,I write a multithread program, in order to test the highest CPU usage when the certain number of the thread are concurrent.

    The experimental data is as follow:
    the thread number    the highest usage of CPU  
    5                               16            
    25                              32             
    50                              28          
    55                              32         
    60                              28             
    61                              30        
    62                              32             
    63                              30           
    64                              31  
    100                            30
    500                            29
    1000                          29  

    Conclusion:The number of thread is from 25 to 1000, the highest usage of CPU fluctuates between 28 and 32.

    Qusetion:
    1、 Why not the usage of CPU is higher than 32%?
    2、  In the Windows Server 2008 R2 Enterprise, are there any restrictions for the CPU usage of the process ?

    • Changed type Helen Zhao Wednesday, February 29, 2012 5:01 AM for more ideas from more members
    Tuesday, February 28, 2012 3:43 AM

All replies

  • AFAIK, there are no restrictions.  Try this code:

    int main()
    {
        int i = 0;
        while(true)
        {
            i++;
        }
        return 0;
    }

    It should spike a single core to 100% (set the processor affinity if you have to).  If it doesn't then it could mean there's a restriction, but I'm 99% sure there isn't one and you should see the spike.  If your code doesn't hit 100% CPU utilization it could be due to other bottlenecks, like hardware I/O.


    Jose R. MCP

    Tuesday, February 28, 2012 4:07 AM
  • Jose R. MCP,

        I try the above code in the in the operating system of the Windows Server 2008 R2 Enterprise,the CPU utilization is 3%.

        My computer configuration is this:

        Operating system:Windows Server 2008 R2 Enterprise Service Pack 1
        processor:   Intel(R) Xeon(R) CPU   E7520 @ 1.87GHz  1.87GHz (4 processor)
        memory: 16.0GB
        System type:64 operating system

        Did you test the above code in the operating system of the Windows Server 2008 R2 Enterprise?

    Bery



    Tuesday, February 28, 2012 9:22 AM
  • Jose R. MCP,

        I try the above code in the in the operating system of the Windows Server 2008 R2 Enterprise,the CPU utilization is 3%.

        My computer configuration is this:

        Operating system:Windows Server 2008 R2 Enterprise Service Pack 1
        processor:   Intel(R) Xeon(R) CPU   E7520 @ 1.87GHz  1.87GHz (4 processor)
        memory: 16.0GB
        System type:64 operating system


    According to http://en.wikipedia.org/wiki/Xeon , an E7520 has four cores, effectively 8 if you include hyperthreading.

    Taking the above configuration (i.e. that this system has 4 E7520 Xeon processors), this means that your system effectively has 32 threads. 

    Windows reports total CPU utilization, so with 32 threads, the highest CPU utilization of any one thread is 100%/32, or just over 3% as you observe.  In other words, there's no artificial limit - it's simply using one thread to the maximum.


    Answering policy: see profile.

    Tuesday, February 28, 2012 10:51 AM
  • This tab in task manager is useful. You can see the CPU Usage there. To the left is the little graph that says how much of your total CPU power has been used. Then to the right there is graphs for the seperate logical processors. (The definition of a logical processor is how many cores/hyper threads there are in total on your physical processors, so there should be 32 of them on your system.)

    Now, if you start off an application which maxes out one single thread then you will probably notice that it doesn't max anything out. This is surprisingly the scheduler which is doing interesting things (there is no guarantee that a thread will be re-scheduled to run on the same logical processor after it gets interrupted). But as David said you will notice that your CPU usage should be giving the same reading as if you have one logical processor maxed (so it will be saying 3%). On my system it usually alternates between 4 of the graphs.

    Now, if you run that test process again and then go to the processes tab, find the test process (it should be the one taking up 3%), right click on it, select set affinity and in the window which appears deselect all but one of the logical processors and then click ok. If you then go back to the Performance tab then you should notice that the test application is now taking up 100% of one of the graphs.


    This is a signature

    Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    Tuesday, February 28, 2012 1:04 PM
  • Hi bery.zhang,

    Acoording to your description, I'd like to change the thread type to "General Discussion" so that you can get more ideas from more community members.

    Thanks for your understanding and active participation in the MSDN Forum.
    Best regards,


    Helen Zhao [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, February 29, 2012 5:01 AM
  • How to use all of the CPU, and make the total CPU utilization rate reached 100%?

    Bery

    Wednesday, February 29, 2012 8:48 AM
  • Increase how many threads your application uses. A single thread in your process will only ever be scheduled to run on one logical processor at a time so the only way to increase that is to just use more threads.

    The Processes and Threads section in the MSDN is something you should read regarding this, and if you are going to use multiple threads, the Synchronisation section is something you should read for other useful information.


    This is a signature

    Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    Wednesday, February 29, 2012 9:21 AM
  • Thank you!

    I will read the materials that you write in the above.


    Wednesday, February 29, 2012 9:58 AM
  • The experimental data is as follow:
    the thread number    the highest usage of CPU  
    5                               16            
    25                              32             
    50                              28          
              
    Conclusion:The number of thread is from 25 to 1000, the highest usage of CPU fluctuates between 28 and 32.

    Given the discussion about the number of CPU threads,  I think you should investigate all thread counts between 25 and 35 before coming to this conclusion.

    Answering policy: see profile.

    Wednesday, February 29, 2012 10:27 AM