Why does a busy loop often uses 100% of the cpu time while loops that implement complex algorithms would use much much less?
thanks :)
A complex algorithm can certainly use 100% of the cpu. However, many loops that implement complex algorithms either explicitly yield the thread periodically and/or have some code that calls down into the OS at some point, where either the thread is yielded or something that requires a wait (such as calling on a co-processor) happens.