By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,551 Members | 2,741 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,551 IT Pros & Developers. It's quick & easy.

What would cause this problem? CPU usage 100%

P: n/a
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, there is no reason the cpu
load should change. What would cause this kind of behavior? I have
no clue where to start looking.
Nov 15 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
John Smith wrote:

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, there is no reason the cpu
load should change. What would cause this kind of behavior?
Maybe the cpu had nothing better to do in the morning?
I have no clue where to start looking.


Probably
news:comp.programming

--
pete
Nov 15 '05 #2

P: n/a
"John Smith" <js****@company.com> wrote in message
news:k%****************@twister.southeast.rr.com.. .
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, there is no reason the cpu
load should change. What would cause this kind of behavior? I have
no clue where to start looking.


It can be a bug in the program. If the behavior is different from run to run
on the same input data, then either something is uninitialized or you're
using bad indices or bad pointers, using which at one times may give you
more or less expected results but at others not. Also can it be that you use
rand(), don't check errors or some other things, have race conditions or
simply your program goes crazy when it runs past midnight due to the
incorrect time/date handling?

Alex
Nov 15 '05 #3

P: n/a
John Smith <js****@company.com> writes:
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, there is no reason the cpu
load should change. What would cause this kind of behavior? I have
no clue where to start looking.


Not here. Try a windows group.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 15 '05 #4

P: n/a
John Smith wrote:

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, there is no reason the cpu
load should change. What would cause this kind of behavior? I have
no clue where to start looking.


Your program has been taking lessons from camels, whose noses
should not be allowed in tents, lest the remainder of the camel
follow.

At any rate it has nothing to do with C, and you should be asking
on some group with Microsoft, Windows, or similar verbiage in its
name. It may well be just another Windows bug, and may or may not
have any meaning.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 15 '05 #5

P: n/a
John Smith wrote:
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, there is no reason the cpu
load should change. What would cause this kind of behavior? I have
no clue where to start looking.


You provide very little in terms of useful information so these are
really just a few stabs in the dark: did you check memory usage? If
there was a small memory leak that accumulated overnight to the point
where more memory than was physically available had been allocated,
your program may be causing the machine to thrash as it caused memory
to be swapped in/out. Is your program performing some sort of
operation whose time complexity is dependant on a factor changes as the
program runs (such as inserting items into a sorted list)?

What you should try to do is reduce the program to the smallest amount
of code that produces the issue. If you still can't figure it out and
are writing Standard C, post a minimal, complete, and compilable
example here and we can take a look at it for you.

Robert Gamble

Nov 15 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.