473,545 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3771

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************ **********@f14g 2000cwb.googleg roups.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
2582
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 when the object is instantiated. I'd ideally like to keep as many objects as possible in memory, but I can get rid of any object the program isn't...
2
422
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 test the stuff, I keep to open that child data form for about 10 times. the memory usage shown in GC and task manager both increase. Then I close...
3
673
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 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.
5
2912
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 next morning, the cpu usage had jumped to 100%. I observed the same behavior on two different machines. Since the program does repetitive jobs,...
4
3771
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, Graphics.FillRectangle causes a lot of soft page faults - order of 700/sec and more... When Control.DoubleBuffer=false, we have no page faults at all - 0/sec. Has...
6
2734
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 directive to vary its cache based on that property value? I.e., I have: <my:control runat="server" id="mcOne" Flag="One" /> <my:control...
2
1337
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 but from a string variable. i.e. I have 14 controls that have a name which is a permutation of 4 characters, my program selects which control to...
11
30084
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 updated to .NET v2 and run Zone Alarm Internet Sec Suite 2006 for firewall and av. When I log off/shut down the computer a dialog box appears as...
3
1256
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 minimize the program to the taskbar, memory usage drops to about 500KB. And, when I restore the app to the foreground memory usage reports about 2 Megs...
17
7935
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 while, the application is using more than 100 or 150 Mb in RAM, and if I let it continue, it can leave the system without memory. I've been watching in...
0
7486
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7932
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7442
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7776
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6001
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3456
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1905
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1032
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
729
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.