What would cause this problem? CPU usage 100%

Discussion in 'C Programming' started by John Smith, Jul 15, 2005.

  1. John Smith

    John Smith Guest

    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.
     
    John Smith, Jul 15, 2005
    #1
    1. Advertising

  2. John Smith

    pete Guest

    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
     
    pete, Jul 16, 2005
    #2
    1. Advertising

  3. "John Smith" <> wrote in message
    news:k%WBe.12$...
    > 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
     
    Alexei A. Frounze, Jul 16, 2005
    #3
  4. John Smith <> 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) <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.
     
    Keith Thompson, Jul 16, 2005
    #4
  5. John Smith

    CBFalconer Guest

    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
     
    CBFalconer, Jul 16, 2005
    #5
  6. 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
     
    Robert Gamble, Jul 16, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2l2YXJhbWFuLlM=?=

    CPU Usage is 100% while executing Web Application

    =?Utf-8?B?U2l2YXJhbWFuLlM=?=, Feb 18, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    439
    Ken Cox [Microsoft MVP]
    Feb 18, 2005
  2. =?Utf-8?B?QW5rdXIgR29lbA==?=

    100% CPU usage becoz of System.Configuration.ConfigurationExceptio

    =?Utf-8?B?QW5rdXIgR29lbA==?=, Apr 13, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    363
    =?Utf-8?B?QW5rdXIgR29lbA==?=
    Apr 13, 2006
  3. mk
    Replies:
    1
    Views:
    10,356
    Robert Olofsson
    Jul 25, 2003
  4. fred
    Replies:
    3
    Views:
    284
    Zifud
    Mar 17, 2005
  5. Replies:
    5
    Views:
    891
Loading...

Share This Page