LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Top - 0% idle (https://www.linuxquestions.org/questions/linux-newbie-8/top-0-idle-870313/)

jerunh 03-22-2011 03:05 PM

Top - 0% idle
 
When I run ‘top –d 0.5’ on my machine and I press ‘1’ to enable the SMP View, I notice that all of the CPU’s keep toggling between 100%idle and 0% idle.
The odd part is that when a CPU goes to 0.0% idle, I would expect to see one or more of the other columns peek, but they are not.

Any idea what is causing this?

Code:

top - 06:35:38 up 14 days, 19:26,  4 users,  load average: 0.05, 0.13, 0.10
Tasks: 237 total,  1 running, 234 sleeping,  2 stopped,  0 zombie
Cpu0  :  0.6%us,  0.2%sy,  0.0%ni, 99.2%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu1  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu2  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu3  :  0.0%us,  0.0%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu4  :  0.5%us,  0.0%sy,  0.0%ni, 99.5%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu5  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu6  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu7  :  0.0%us,  0.0%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  4044220k total,  3581688k used,  462532k free,    89064k buffers
Swap:  8402768k total,      164k used,  8402604k free,  3110136k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                     
12362 root      20  0  143m  32m  14m S    0  0.8  2:24.63 X                                                                             
12407 gdm      20  0  227m  17m  11m S    0  0.4  1:15.01 gdm-simple-gree                                                               
20234 oakesjc  20  0  8900 1304  868 R    0  0.0  0:00.79 top


Soadyheid 03-22-2011 05:57 PM

Welcome to Linux Questions! :)

It's probably something to do with how the kernel "shares" your one running task over eight processors.
In the bad old days you used to time-slice access to the single processor to allow the multitude of tasks to run (Er... that'll be multi tasking) I'm not sure how it works in reverse though?

Play Bonny! :hattip:

jerunh 03-23-2011 08:23 AM

Quote:

Originally Posted by Soadyheid (Post 4299765)

It's probably something to do with how the kernel "shares" your one running task over eight processors.


If this were the case, shouldn't I be seeing some activity in the sy column for the same cpu?

jerunh 03-23-2011 08:33 AM

The CPU's on this machine a relatively new, Dual Intel Xeon E5530 @ 2.40 Ghz.

Here are some the specs from Intel:
Code:

Essentials:
Processor Number            E5530
# of Cores                  4
# of Threads                8
Clock Speed                2.4 GHz
Max Turbo Frequency        2.66 GHz
Intel® Smart Cache          8 MB


Advanced Technologies:
Intel® Turbo Boost Technology          Yes
Intel® Hyper-Threading Technology      Yes   
Intel® Virtualization Technology (VT-x) Yes   
Intel® Trusted Execution Technology    No   
Intel® 64                              Yes   
Idle States                            Yes
Enhanced Intel SpeedStep® Technology    Yes   
Intel® Demand Based Switching          Yes   
Execute Disable Bit                    Yes

Will Any of these "Advanced Technologies" affect how top runs?

Soadyheid 03-23-2011 08:58 AM

Quote:

Will Any of these "Advanced Technologies" affect how top runs?
I've absolutely no idea. Is this causing you some sort of problem or are you just curious? Maybe you have to set the top refresh rate to a very small increment to show what you expect...

Play Bonny! :hattip:

syg00 03-23-2011 10:41 AM

top (re-)reads /proc "files" a lot. This causes skewing in the numbers it generates. The faster is does this, the worse the effect - why are you using fraction(s) of a second ?.

jerunh 03-23-2011 03:14 PM

Quote:

Originally Posted by syg00 (Post 4300511)
top (re-)reads /proc "files" a lot. This causes skewing in the numbers it generates. The faster is does this, the worse the effect

While this statement makes sense, I cant see this being the root cause of what I am seeing. I have run on plenty of machines that work perfectly fine with refresh rates of 0.5 seconds. And this is a pretty new machine with pretty beefy processors. As a matter of fact, on this particular system, the problem doesn't go away until my refresh rate is set to 2.0 seconds. It is just unbearable to watch at this pace.


Quote:

Originally Posted by syg00 (Post 4300511)
why are you using fraction(s) of a second ?.

Only because I wanted a closer to real-time picture of what is going on in my system. I want to watch my applications run and see how they react while processing different pieces of data (in terms of CPU and memory usage).

syg00 03-26-2011 12:46 AM

Are you running natively, or as a guest ?.
I run a i7 (4 core, hiperthreaded), so it also looks as 8 processors. I see similar at -d 0.5 - but the all zero line only appears on one cpu.

Looking at /proc/stat for the cpu data, it appears to be valid (for all cpus) even for small iterations. Guess that might mean "top" can't keep up, and just tosses the data out when it gets the next timer pop. All guesswork, but matches the evidence.

For "good" detail data, have a look at collectl in daemon mode.

jerunh 03-26-2011 10:01 AM

Quote:

Originally Posted by Soadyheid (Post 4300397)
I've absolutely no idea. Is this causing you some sort of problem or are you just curious? Maybe you have to set the top refresh rate to a very small increment to show what you expect...

Play Bonny! :hattip:

This is mostly just curiosity on my end. I want to understand what my machine is doing.


All times are GMT -5. The time now is 09:03 PM.