473,432 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,432 software developers and data experts.

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

Nov 15 '05 #1
4 3758

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.

Nov 15 '05 #2
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

Nov 15 '05 #3
>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
Nov 15 '05 #4
Davy wrote
(in article
<11**********************@f14g2000cwb.googlegroups .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)

Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ian | last post by:
Hi all, I have a problem. I have an application which needs to work with a lot of data, but not all at the same time. It is arranged as a set of objects, each with lots of data that is created...
2
by: Jarvis | last post by:
I've made a testing program to test the memory usage of some Data Forms. I create a MDI parent form with one single MDI child form, which is a Data Form generated by .NET Data Form Wizard. To...
3
by: Robert | last post by:
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...
5
by: John Smith | last post by:
I am writing a program which should keep running if not interrupted. While testing the program, I noticed that when the program was first run, the cpu usage (on WinXP) was between 0 to 2 %. In the...
4
by: tbatwork828 | last post by:
Related to my other post on Graphics.FillRectangle and a lot of page faults caused by this call... We determine that when Control.DoubleBuffer=true to avoid the flicker effect,...
6
by: Tom Kiefer | last post by:
Question: If I have an ASP.NET User Control which defines/exposes a property that the page can use to specify a mode or data subset for the control to use, is there a way to tell the @OutputCache...
2
by: Merlin | last post by:
Hi I have a control that allows embeddable editors, so for example I can set a property of controlsEmbeddableEditor =me.TextBox1 on my form, no problem here - what I want to do is the same thing...
11
by: Hoku | last post by:
I am using dual monitors on a dual head ATI AGP4x video card. I installed the Nov 11 2005 release of ATI's catalyst control center with Hydravision to manage the dual monitor setup. I recently...
3
by: Rob Harris | last post by:
When I run my program memory usage under Task Manager's Processes tab indicates about 9 megs. And as I do things with the program memory usage witll top out at about 12 Megs. However, if I...
17
by: Cesar | last post by:
Hello people. I'm having a Winform app that contains a webbrowser control that keeps navigating from one page to another permanentrly to make some tests. The problem I'm having is that after a...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.