[CentOS] CPU usage from top

Fri Dec 9 15:31:10 UTC 2005
Bowie Bailey <Bowie_Bailey at BUC.com>

I'm seeing some strange results from top on CentOS 4.0.  When it first
starts, it reports low CPU usage.  The next refresh (and subsequent)
refreshes, it shows high CPU usage.  In both cases, there is nothing
shown in the process list that is using much CPU.  What is causing
this?

Here is some truncated output from a single run of "top -b -n 2":

----------------------------------------------------------------------------
--
top - 10:22:02 up 34 days, 14:36,  2 users,  load average: 0.98, 0.56, 0.51
Tasks: 116 total,   1 running, 115 sleeping,   0 stopped,   0 zombie
Cpu(s):  3.7% us,  0.7% sy,  0.0% ni, 94.2% id,  1.3% wa,  0.0% hi,  0.0% si
Mem:   1034676k total,   610804k used,   423872k free,    35796k buffers
Swap:  1052248k total,    14220k used,  1038028k free,   314524k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
16412 root      16   0  2280  864  664 R  5.6  0.1   0:00.06 top
    1 root      16   0  3148  516  464 S  0.0  0.0   0:01.91 init
    2 root      RT   0     0    0    0 S  0.0  0.0   0:04.32 migration/0
    3 root      34  19     0    0    0 S  0.0  0.0   0:00.34 ksoftirqd/0
    4 root      RT   0     0    0    0 S  0.0  0.0   0:02.32 migration/1
    5 root      34  19     0    0    0 S  0.0  0.0   0:00.39 ksoftirqd/1
    6 root       5 -10     0    0    0 S  0.0  0.0   0:00.13 events/0
    7 root       5 -10     0    0    0 S  0.0  0.0   0:00.00 events/1
    8 root       5 -10     0    0    0 S  0.0  0.0   0:00.18 khelper
    9 root       5 -10     0    0    0 S  0.0  0.0   0:00.00 kblockd/0


top - 10:22:05 up 34 days, 14:36,  2 users,  load average: 0.98, 0.56, 0.51
Tasks: 116 total,   1 running, 115 sleeping,   0 stopped,   0 zombie
Cpu(s): 49.1% us,  1.6% sy,  0.0% ni, 48.8% id,  0.2% wa,  0.2% hi,  0.2% si
Mem:   1034676k total,   610804k used,   423872k free,    35800k buffers
Swap:  1052248k total,    14220k used,  1038028k free,   314520k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
16412 root      17   0  2288  960  748 R  1.6  0.1   0:00.11 top
16052 bowieb    16   0  8288 2232 1812 S  0.3  0.2   0:03.04 sshd
    1 root      16   0  3148  516  464 S  0.0  0.0   0:01.91 init
    2 root      RT   0     0    0    0 S  0.0  0.0   0:04.32 migration/0
    3 root      34  19     0    0    0 S  0.0  0.0   0:00.34 ksoftirqd/0
    4 root      RT   0     0    0    0 S  0.0  0.0   0:02.32 migration/1
    5 root      34  19     0    0    0 S  0.0  0.0   0:00.39 ksoftirqd/1
    6 root       5 -10     0    0    0 S  0.0  0.0   0:00.13 events/0
    7 root       5 -10     0    0    0 S  0.0  0.0   0:00.00 events/1
    8 root       5 -10     0    0    0 S  0.0  0.0   0:00.18 khelper
    9 root       5 -10     0    0    0 S  0.0  0.0   0:00.00 kblockd/0
----------------------------------------------------------------------------
--

Notice 3.7% usage on the first one and 49.1% usage on the second.

I suspect that top isn't showing me everything.  I know that some
versions of top had problems with showing proper CPU usage for
threaded applications.  Is that still a problem with the current
version of top?

Bowie