Re: Why INFINITE loop in a thread occupy so much CPU time??



Perhaps because you asked it to? If you write a computation that consumes all the CPU, it
is going to, guess what, consume all the CPU! And that's what you've written! So
presumably you WANT to consume 100% of the available CPU time.

I have no idea what while(1) means anyway. while(TRUE) makes sense; while(true) makes
sense. What's an integer got to do with it?
joe
On Wed, 14 Nov 2007 22:16:44 -0800 (PST), lostlander <lostlander.tom@xxxxxxxxx> wrote:

I've got a thread:

threadFunc(LPVOID pdata)
{
while(1)......
}

why it takes so much cpu time on windows??
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: Where to find statistics for fetched programs?
    ... I got the question how frequently programmes are fetched, ... and then how much CPU they consume. ... This in order to put together kind of a hit parade of big CPU consumers & then tackle their tuning. ... RMF can't help me while Monitor I and Monitor III provide long-term data collection about system workload and resource utilization, while covering all hardware and software components of the system. ...
    (bit.listserv.ibm-main)
  • Where to find statistics for fetched programs?
    ... I got the question how frequently programmes are fetched, ... and then how much CPU they consume. ... This in order to put together kind of a hit parade of big CPU consumers & then tackle their tuning. ... RMF can't help me while Monitor I and Monitor III provide long-term data collection about system workload and resource utilization, while covering all hardware and software components of the system. ...
    (bit.listserv.ibm-main)
  • Re: CPU usage, memory and virtual memory
    ... some applications can consume close to 100% cpu ... usage and freeze up the machine. ... tells me it consumes 99% cpu and a lot of memory and virtual memory ...
    (microsoft.public.vc.mfc)
  • Re: Managed directsound problem under heavy CPU load
    ... Whenever you have badly behaved threads that consume 100% CPU there is going ... The correct way is to yield at least once ... frequency of the call you're probably better off calling Sleep() with a ...
    (microsoft.public.win32.programmer.directx.audio)
  • Re: calculating time taken for an operation in CPU Cycles
    ... #define EPOCHFILETIME ... to be 0.But how can a operation consume no CPU cycle or time (in ...
    (alt.lang.asm)