Whenever I open htop
, it shows CPU usage suddenly shooting up to 100% on a singe core.
I take it gathering statistics for htop
is not that intensive?!
Why does htop
suddenly show this spike?
htop
Whenever I open htop
, it shows CPU usage suddenly shooting up to 100% on a singe core.
I take it gathering statistics for htop
is not that intensive?!
Why does htop
suddenly show this spike?
Best Answer
You're seeing a side effect of the program seeing its loading resource usage. Loading an executable and its libraries into memory, initializing and turning control over to program is not a free operation: it involves the CPU, memory and (if it hasn't been cached) disk.
Here's
top
showing its usage immediately upon starting:After 10 seconds (it's the same for smaller periods, but I wanted to be able to copy the text at startup):
Does
top
really use 6.2% of the CPU to do its work? No: that's the loading work that all programs will have at startup. Usage goes down to 0.1% after the program has settled down.It's unlikely that
htop
is using 100% of a CPU (there's possibly a bug there), but it's not strange that it has higher usage when starting either.