If I have an empty while loop in my code such as:

while(true);

It will drive the processor usage up to about 25%. However if I do the following:

while(true)
    Sleep(1);

It will only use about 1%.

So why is that?

Update: Thanks for all the great replies, but I guess I really should have asked this question, What's the algorithm behind sleep()? which is more of want I wanted to know.

c++ c
Edit
Report