TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Why does running a few instances of DIR /s in Command prompt load CPU heavily?

2 点作者 fzkl超过 16 年前
Opening 3-5 windows command prompt and running DIR /S to list all subdirectories increases CPU load to 80%. I have seen this type of significant load on the CPU in different platforms. Any idea why a simple task like directory listing consumes so much CPU?

1 comment

jacquesm超过 16 年前
That's because you are the only user on the system and you're asking the filesystem to tell you everything it knows about all your files.<p>Strictly speaking it is an io-bound operation, but with the number of files on your machine and some aggressive caching it will quickly turn into a memory-to-display translation (involving lots of font rendering and scrolling) and that is cpu-bound, not io-bound.<p>Look at it this way, the 'idle' process also consumes lots of cpu power, but it does absolutely nothing. When you're alone on a machine you have the power to max it out with anything cpu bound, no matter how simple. A loop that counts from 0 to 1.000.000.000 (assuming it's not optimized out) will consume 100% cpu time unless you tell your system explicitly otherwise.<p>The only way to <i>not</i> max out the cpu is to deliberately slow the process down by installing small sleep periods in between operations, but you really want your 'dir /s' to run as fast as it can.
评论 #465650 未加载