What would cause this problem? CPU usage 100%

J

John Smith

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

pete

John said:
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
 
A

Alexei A. Frounze

John Smith said:
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
 
K

Keith Thompson

John Smith said:
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.
 
C

CBFalconer

John said:
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.
 
R

Robert Gamble

John said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top