October 30th, 2006

Why can't I get my program to use more than 50% of the CPU?

This is sort of the reverse of Why is my CPU usage hovering at 50%?, but the answer is the same.

When I run a CPU-intensive task, the CPU percentage used by that process never goes above 50%, and the rest is reported as idle. Is there some setting that I set inadvertently which is preventing the program from using more than half of the CPU?

My psychic powers tell me that you have a single processor with hyperthreading enabled. (Because if you had a dual processor machine, you probably would have mentioned it in your question.) And my psychic powers tell me furthermore that the program in question is single-threaded, or at least has only one thread that is doing CPU-intensive work. Therefore, that thread is being run by one of the hyperthreading units of the CPU, and the other one isn’t doing anything.

That’s why you can’t get more than 50% CPU usage.

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.