![]() |
Control CPU usage of a program?
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 |
Re: Control CPU usage of a program?
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 |
Re: Control CPU usage of a program?
"Robert" <zhushenli@gmail.com> wrote in message news:1124638273.563224.237320@g49g2000cwa.googlegr oups.com... > 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-lit...t.html#faq-5.9 -- Sumit Rajan <sumit.rajan@gmail.com> |
Re: Control CPU usage of a program?
In article <DYSdnTHJKNLtUJXeRVn-qA@comcast.com>, Victor Bazarov
<v.Abazarov@comAcast.net> 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 /\/\/\/\/ /\/\/ chris@phaedsys.org www.phaedsys.org \/\/\ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ |
| All times are GMT. The time now is 08:00 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.