Score:0

Overall CPU utilization% of 'htop' is smaller than a process' cpu usage

in flag

Because of my stupidity, I can't provide any screenshot of such phenomenon. My 2-core system's cpu utilization(which is output of htop command) is smaller than the cpu usage of a process.

For example,

  • utilization of core0 is 13%
  • utilization of core1 is 23%
  • CPU usage(%CPU) of a multithreaded(about 30 threads) process is 54%

How can this possible? I'm currently reading code of htop, but I can't find any clue..

Doug Smythies avatar
gn flag
Your 30 threads would likely have scheduling wait times, for an available CPU. That would not show in the CPU utilization, but might be included in your process stuff. It should also reflect in the load average. do `uptime`. For example, I am running 2500 threads right now and each of 12 CPUs show about 13% utilization but the load average is 20.
양석우 avatar
in flag
Thank you for comment!! But I still have some questions about your comment. What exactly is 'scheduling wait times'? Do you mean the duration of time which a thread is in runqueue, but not executing? A process' cpu usage is calculated by utime+stime/total_time, and each time is calculated by tick, so I don't think waiting in runqueue is accounted in utime and stime... Can you elaborate on that please?
Doug Smythies avatar
gn flag
I can't really elaborate, it was just a thought, backed up by a possibly not relevant example.
Doug Smythies avatar
gn flag
I ran 30 threads on my little test program and ran htop at 30 seconds per sample, did a frame grab, and summed manually: Total CPU usage by summing CPUs: 191.4%; Total program usage by summing each thread: 190.4%
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.