惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Visual Studio Blog
IT之家
IT之家
博客园 - 聂微东
The Cloudflare Blog
月光博客
月光博客
阮一峰的网络日志
阮一峰的网络日志
S
SegmentFault 最新的问题
Apple Machine Learning Research
Apple Machine Learning Research
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
H
Help Net Security
博客园 - 叶小钗
V
V2EX
WordPress大学
WordPress大学
J
Java Code Geeks
Hugging Face - Blog
Hugging Face - Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园_首页
C
Check Point Blog
B
Blog
D
DataBreaches.Net
美团技术团队
罗磊的独立博客

The Register - Software: OSes

Fedora: Microsoft is all aboard, but Deepin is dumped Microsoft promises to do better, but it has a long way to go First big Microsoft update after vow to 'win back fans' Who needs ghost train scares when Windows is such a fright? Microsoft boss tells investors the company is working to 'win back fans' Microsoft boss says company is working to 'win back fans' Linux cryptographic code flaw offers fast route to root Fedora 44 is out – countless versions of it Microsoft sets its sights on the past with 86-DOS and PC-DOS Microsoft updates the Windows Update Experience Windows second-chance setup hurts IT, productivity Ubuntu Resolute Raccoon drops Xorg, keeps X11 apps alive More ancient Linux device support facing the ax WSL9x hacks Linux into ancient Windows 9x systems UK tribunal sends £2B claim accusing Microsoft of overcharging for licensing to trial Zorin OS 18.1 released - and the Lite edition reappears Linux 7.1 will have an optional new NTFS driver Microsoft releases Windows Server update to fix April update 20-year-old Enlightenment E16 bug finally gets patched 20-year-old Enlightenment E16 bug finally gets patched Raspberry Pi OS ends open-door policy for sudo Firefox Nightly adds Web Serial after years of saying no Windows Update: Torture chamber for seldom-used PCs Windows Update: Torture chamber for seldom-used PCs Notepad loses Copilot icon as Microsoft gives subtlety a try Notepad loses Copilot icon as Microsoft gives subtlety a try Microsoft attempts to untangle Windows Insider program Adobe finally patches PDF pest after months of abuse NHS pays £46K to prep next Microsoft licensing round Linux 7.0 debuts as Linus Torvalds ponders AI's impact
Task Manager's CPU%: an obituary for the recent past
Richard Speed Richard Speed · 2026-04-21 · via The Register - Software: OSes

OSes

Task Manager's CPU meter is an obituary for the recent past, says the engineer who built it

Spoiler: There's no magic value. Just a timer, some kernel calls, and too much coffee

Windows has always had a built-in portal to the very recent past: Task Manager's CPU usage meter.

Task Manager in Windows XP

Task Manager in Windows XP

"The CPU number in Task Manager is a moving little obituary for the immediate past," explained former Microsoft engineer Dave Plummer, "Not what happened at the moment that your eyeballs landed on the row."

Plummer wrote the original version of Task Manager, back when it was a lean, mean, process-killing machine rather than the considerably chubbier and cuddlier tool of today. He has since led viewers through a tour of the source code, admitting along the way that he left his telephone number in the comments while chasing a strange bug in how CPU numbers were being reported. That bug is the subject of his latest explanation.

So how did Task Manager report the CPU percentage? The answer is complicated. Windows had no magical CPU usage value waiting to be read. Instead, Plummer's Task Manager was timer-driven. Every time the timer fired, the code asked the kernel for cumulative execution times and compared them to the previous sample.

"For an individual process, the math essentially is the cumulative current CPU time minus the previous cumulative CPU time. And that gives you how much CPU has been consumed by that process during the interval between the samples," he said.

"The per-process percentage is just that process's delta divided by the total delta."

"Now," the veteran engineer continued, "if that looks like the sort of thing you write when you've been locked in an office too long with a copy of Petzold and a lot of coffee, that's because it basically is."

"Petzold" refers to the books by Charles Petzold, which were an indispensable companion to Windows programmers in the 1990s, well into the 2000s and beyond. Many long-serving engineers are likely still to have a well-thumbed copy or two on their shelves.

Elegant as the solution was, it had wrinkles. Occasional quirks in the Windows kernel's reporting could make percentages fail to add up to 100, prompting a festooning of asserts in the code - and a request to contact Plummer directly if CPU usage ever exceeded that figure.

And then there is the problem of modern hardware. Plummer said: "Back in the day, the scheduler's time accounting and the processor's actual throughput were much more tightly coupled because the CPU clocks were comparatively static. On modern CPUs, though, the hardware is constantly changing gears.

"A mostly idle core may be downclocked, parked, or dropped into a state of sleep, sipping power through a cocktail straw, and then the instant that real work shows back up, it can jump up to a much higher frequency or even turbo past its nominal clock."

As Task Manager's accounting was fundamentally time-based, the work accomplished in any given interval varied wildly depending on what frequency the silicon was running at.

"The meter isn't wrong, but it's measuring sort of occupancy rather than productivity." It was built for a simpler era, before CPU frequency scaling and throttling became the norm.

"When the numbers [today] 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."

Plummer told The Register: "My main impetus was to account for every cycle, making sure each was properly attributed to the right 'cost center' and then determining how much actual work occurred in that time window. That seems pretty accurate, and I guess more important, 'felt' right to me in term of what the machine was doing."

He was unable to comment on how the modern iteration of Task Manager performed the trick, telling us, "I know how I would have done it but hate to assume!" ®