Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 May 2002 17:53:31 -0400 (EDT)
From:      Jason Borkowsky <jcborkow@tcpns.com>
To:        hackers@freebsd.org
Subject:   CPU context switching/load numbers
Message-ID:  <Pine.BSF.4.44.0205021530360.72136-100000@bemused.tcpns.com>

next in thread | raw e-mail | index | archive | help

Greetings! I have a FreeBSD-4.5 box that is a specialized server box. It
doesn't run any user processes and only runs a bunch of small, server
efficient processes.

I have an inconsistency that I am trying to explain. When I do a "w" command
on the box, I see this:

 7:31PM  up 74 days, 39 mins, 1 user, load averages: 1.12, 0.94, 0.93

This says I have a load of 1.12 over the past minute, or, for every
available CPU interval, I have 1.12 processes requesting the CPU.

However, if I do a vmstat, I see this:

procs   memory         page                    disks   faults      cpu
 r b w   avm     fre    flt  re  pi  po  fr  sr w0 w1   in   sy  cs us sy id
 0 0 0  221896   58512    3   0   0   0   4   0  0  0   78  169  78  1 14 85

This tells me the CPU is 85% idle, and spends 14% of its time running system
processes and 1% of the time running user processes (such as the shell I am
using to console into the box with).

The inconsistency I have is the run queue shows 1.12 processes waiting for
the CPU, however, the CPU/IO system is spending most of its time idle. So
the question I have is the source of this inconsistency: If I have more than
1 job clamoring for the CPU at any instant, why is the CPU 85%+ idle? The
only rationalization I can come up for this is I have a lot of jobs trying
to get on the CPU, but, when they do get on the CPU, they don't use the full
amount of CPU allotted to them, and return it early. However, I only have 78
context switches (cs) and would expect to have many more if jobs were
getting switched out that fast.

So, the two questions I have are:

1. How is it my load average is over 1, but my single CPU is 85% idle?
2. If a process is finished with the CPU, does it signal the kernel, and get
context switched early, or does it just wait until the kernel schedules the
context switch, in effect wasting CPU cycles?


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.44.0205021530360.72136-100000>