Control CPU usage of a program?

Discussion in 'C++' started by Robert, Aug 21, 2005.

  1. Robert

    Robert Guest

    Hi all,

    I am writing programs of algorithms using C++ and C. When I run the
    programs,
    I found the programs take 100 percent of the CPU usage and I cannot run
    any other program.
    How to control the CPU usage percentage?
    For example, let the program take 30 percent of the CPU usage? Thanks!

    BTW, the circumstance is Windows 2k and XP.

    Best regards,
    Robert
     
    Robert, Aug 21, 2005
    #1
    1. Advertising

  2. Robert wrote:
    > I am writing programs of algorithms using C++ and C. When I run the
    > programs,
    > I found the programs take 100 percent of the CPU usage and I cannot
    > run any other program.
    > How to control the CPU usage percentage?
    > For example, let the program take 30 percent of the CPU usage? Thanks!


    There is no way in C++ to do that. The C++ language is specified
    without considering any other programs. All that is given to the
    host operating system to control.

    > BTW, the circumstance is Windows 2k and XP.


    Then go to 'comp.os.ms-windows.programmer.win32' or any relevant
    newsgroup from the 'microsoft.public.*' hierarchy.

    V
     
    Victor Bazarov, Aug 21, 2005
    #2
    1. Advertising

  3. Robert

    Sumit Rajan Guest

    "Robert" <> wrote in message
    news:...
    > Hi all,
    >
    > I am writing programs of algorithms using C++ and C. When I run the
    > programs,
    > I found the programs take 100 percent of the CPU usage and I cannot run
    > any other program.
    > How to control the CPU usage percentage?



    Off-topic. Please see:
    http://www.parashift.com/c -faq-lite/how-to-post.html#faq-5.9
    --
    Sumit Rajan <>
     
    Sumit Rajan, Aug 21, 2005
    #3
  4. Robert

    Chris Hills Guest

    In article <>, Victor Bazarov
    <> writes
    >Robert wrote:
    >> I am writing programs of algorithms using C++ and C. When I run the
    >> programs,
    >> I found the programs take 100 percent of the CPU usage and I cannot
    >> run any other program.
    >> How to control the CPU usage percentage?
    >> For example, let the program take 30 percent of the CPU usage? Thanks!

    >
    >There is no way in C++ to do that.


    Yes there is! You can do most things with C++ but how it is done it is
    Off topic for this NG.

    >The C++ language is specified
    >without considering any other programs.


    Not really. AFAIK the standard just specifies the language it does not
    specify other programs or OS

    > All that is given to the
    >host operating system to control.


    What if there is no host operating system? What if this "program" is
    the OS? IF the program is the OS then it can clearly control the CPU
    loading.

    >> BTW, the circumstance is Windows 2k and XP.

    >
    >Then go to 'comp.os.ms-windows.programmer.win32' or any relevant
    >newsgroup from the 'microsoft.public.*' hierarchy.


    We agree here. This is a Windows programing problem. I am sure that he
    will be able to implement something in C++ to solve the problem he is
    just asking in the wrong place.

    --
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
    /\/\/ www.phaedsys.org \/\/\
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
     
    Chris Hills, Aug 21, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Davy

    Control CPU usage of a program?

    Davy, Aug 21, 2005, in forum: C Programming
    Replies:
    6
    Views:
    1,341
    HalleHamar
    Nov 4, 2012
  2. hvt
    Replies:
    0
    Views:
    1,215
  3. hvt
    Replies:
    0
    Views:
    1,477
  4. Sethu

    CPU usage program

    Sethu, Oct 8, 2007, in forum: C++
    Replies:
    11
    Views:
    643
    Zeppe
    Oct 9, 2007
  5. CPU usage program

    , Oct 8, 2007, in forum: C Programming
    Replies:
    14
    Views:
    630
    Peter Pichler
    Oct 15, 2007
Loading...

Share This Page