3

I'm having some performance issue on my embedded device:

# uptime 
 14:59:39 up  5:37, load average: 1.60, 1.50, 1.53

Very bad for a monocore system ... :-p! However if I check with the top utility, I always have an idle time around 80% !

Mem: 49020K used, 75960K free, 0K shrd, 0K buff, 21476K cached
CPU: 12.5% usr  4.8% sys  0.0% nic 81.7% idle  0.0% io  0.9% irq  0.0% sirq
Load average: 1.30 1.42 1.51 1/80 18696

After reading some articles, I would better believe the uptime command. But why this difference? Is my CPU really idle ??!

morandg
  • 1,066
  • 3
  • 14
  • 30

3 Answers3

6

Load is not just a measure of how many processes in the R state (runnable, could use CPU time), but also processes in the D state (uninterruptable sleep, usually waiting for IO). You likely have a process in the D state which is contributing to load, but not using cpu. This command would show you all the current processes which are contributing to load:

ps aux | awk '$8~/[RD]/'

Have a look at that output and see if you have commands in the D state (in the 8th column)

stew
  • 11,276
  • 36
  • 49
  • So if I understood well, Zombies and Sleeping processes are counted in load average and also for the top idle time? I thought "idle" was when the CPU did some 'nop' this means actually NOTHING but the CPU can also be in idle state when a process is waiting for a ressource? So my understanding of "idle" was flawed ... Thanks for pointing this out! – morandg Dec 13 '11 at 15:39
  • 1
    not all sleeping processes, processes in the S state are not counted, those are "sleeping because I have nothing to do". but processes in the D state "I would do stuff, but I have to wait on IO" do contribute to load. Yes. idle means "the cpu is doing a noop" If a process can't do anything until IO complete's it not using the CPU, but it is adding to the load. – stew Dec 13 '11 at 15:45
  • 1
    To my knowledge, Z procs don't count towards the loadavg. If you believe otherwise, please cite source code. – jørgensen Dec 13 '11 at 16:07
  • jørgensen was correct. I was misremembering about zombie processes, and I've changed my answer to no longer mention them. – stew Dec 13 '11 at 16:25
0

you'd better to learn what 'load average' stands for.

in short, it's a number of processes, waiting for some resource, and the resource may be CPU, HDD, serial port, ...

zed_0xff
  • 32,417
  • 7
  • 53
  • 72
0

The Load average seems a little high, that could meen that the cpu is busy with things like I/O(disk/network) or thread managment(you may have too meny running).

Greg Harris
  • 114
  • 1
  • 8