Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Control CPU usage of a program?

Reply
Thread Tools

Control CPU usage of a program?

 
 
Davy
Guest
Posts: n/a
 
      08-21-2005
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,
Davy

 
Reply With Quote
 
 
 
 
Castreuil Anthony
Guest
Posts: n/a
 
      08-21-2005

Davy schreef:

> 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,
> Davy


You can't really tell "Take 30 percent", but you can fiddle with thread
priority.

 
Reply With Quote
 
 
 
 
Robert Gamble
Guest
Posts: n/a
 
      08-21-2005
Davy wrote:
> 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!


There is no way to control this in Standard C, it is off-topic here.

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


Good, ask in a group that focuses on those systems.

Robert Gamble

 
Reply With Quote
 
Gordon Burditt
Guest
Posts: n/a
 
      08-21-2005
>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.


A reasonable OS will not let one looping program lock out others
unless the priorities have been set in a non-default manner to give
your program absolute priority over everything else (sometimes
called a "real time priority").

Since Windows 2000 is often used as a server, I find it difficult
to believe it's got a problem like this without some amount of
tweaking settings inappropriately (by either the admin or the
viruses). After all, it manages to cope with a busy webserver with
neither handling web pages nor running viruses locking each other
out.

>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.


I recommend reading the documentation that came with your OS.
Incidentally, I see no reason to limit your program from taking
100% of the CPU *IF THERE'S NOTHING ELSE TO RUN*. Otherwise, it
just wastes that CPU time.

Gordon L. Burditt
 
Reply With Quote
 
Randy Howard
Guest
Posts: n/a
 
      08-21-2005
Davy wrote
(in article
<(E-Mail Removed) .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?


You've asked this same question in multiple newsgroups now
(starting new individual threads in each by the way). You have
been given answers, please don't keep asking.


--
Randy Howard (2reply remove FOOBAR)

 
Reply With Quote
 
HalleHamar HalleHamar is offline
Junior Member
Join Date: Nov 2012
Posts: 2
 
      11-04-2012
I see there are paid writers in here...

Davy asks a legit question, and bs-answers like read the manual for your OS is one of the worse I've ever seen! Who are you working for? Microsoft?
 

Last edited by HalleHamar; 11-04-2012 at 02:38 AM..
Reply With Quote
 
HalleHamar HalleHamar is offline
Junior Member
Join Date: Nov 2012
Posts: 2
 
      11-04-2012
PS! I found a program that might help both Davy and me: donationcoder dot com/Software/Mouser/proctamer/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
control CPU usage kakarukeys Python 8 09-21-2009 12:23 AM
retrieving CPU Usage and Memory Usage information in JAVA hvt Java 0 03-13-2007 01:09 PM
retrieving CPU Usage and Memory Usage information in JAVA hvt Java 0 03-13-2007 01:07 PM
Control CPU usage of a program? Robert C++ 3 08-21-2005 07:15 PM
Need help on memory usage VS PF usage metfan Java 2 10-21-2003 01:58 PM



Advertisments