Former Microsoft engineer Dave Plummer, who has worked on iconic projects like adding ZIP file support to Windows and the Windows NT Start Menu, revealed how the Task Manager actually reads CPU usage. Plummer built the original Task Manager, and made the tool so simple (in programming and engineering terms) to ensure that it does not use up your computer’s resources unnecessarily. However, there have also been some complaints that it sometimes felt that the numbers it showed were a bit off, so he explained why looking up CPU usage is quite complicated, how Task Manager gets the CPU utilization numbers, and why it might show results that are a bit different from what you see and feel on your PC.
“But measuring CPU usage sounds like it ought to be one of the easiest jobs in computing — I mean, either the CPU is busy, or it’s not, right? It’s silicon, not interpretative dance. Surely, you just ask Windows, ‘Hey, how busy are you?’ and it tells you 73%, and then we all go home early — except none of that is true,” Plummer said. “Because the first uncomfortable question is ‘Busy doing what, exactly?’ Busy on one core or all of them? Busy right now, or averaged the last second or two seconds, or however often your UI happens to wake up? Busy is user mode or kernel mode or interrupt time or deferred procedure calls or the idle loop or some weird accounting bucket that only exists because the scheduler needed somewhere to hand the bill? And once you start asking those questions, what looks like a simple speedometer starts looking more like forensic accounting.”
Dave says that Task Manager is timer-driven in that it refreshes every so often to give you an updated figure. This shows that the machine is showing an interpretation of what happened to your PC between each refresh, not a real-time view of your CPU’s actual usage. The easy answer to this would have been to divide the CPU usage by the time elapsed between refreshes, but Plummer says that this depends on the GUI timer firing precisely. He compared this to “trusting a metronome to stay perfectly steady while it’s riding the back of a pickup truck on a pothole-filled dirt road.”
Article continues below
Instead, he programmed the Task Manager to ask for the total time, i.e., the sum of the kernel time and the user time, of each process since it started. It then subtracts the last total it received during the last refresh from that particular process from that value to get its CPU consumption for that period. This number is then divided by how much total CPU time was accounted for and consumed by all processes in between refreshes. While it may sound complicated versus just dividing the total CPU usage by the time elapsed between refreshes, this solution is far more precise.
However, technological advances made this feel inaccurate. Since the accounting is just an average number, between refresh states, it does not take into account the actual work happening at a particular moment. “Modern CPU usage is more like how full the freeway was, rather than how many miles were actually traveled. A half-full freeway with Ferraris on it can move a lot more traffic than a jammed freeway full of old cement trucks,” Plummer explained. “Now, the old Task Manager was built in an era where the time used was a pretty decent proxy for what work got done. But on today’s processors with dynamic frequency scaling, turbo boost, thermal throttling, deep idle states, that connection has gotten a lot looser. So, when the numbers feel a little slippery, it’s not because the tool is broken so much as the hardware stops being simple enough for a single percentage to tell you the whole story.”
He also added a note on the screen saying, “If I were king… CPU usage should be a measure of the amount of work accomplished versus the theoretical maximum work that COULD have been accomplished.” But because he’s already retired from Microsoft, he probably has no say anymore in how Windows should work.
You can find several more interesting stories and explanations on how one of Windows’ most basic tools works on the Dave’s Garage video embedded above.
Stay On the Cutting Edge: Get the Tom's Hardware Newsletter Get Tom's Hardware's best news and in-depth reviews, straight to your inbox. Contact me with news and offers from other Future brands Receive email from us on behalf of our trusted partners or sponsors
Follow Tom's Hardware on Google News, or add us as a preferred source, to get our latest news, analysis, & reviews in your feeds.