Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 02 May 2002 18:23:30 -0400 (EDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Jason Borkowsky <jcborkow@tcpns.com>
Cc:        hackers@freebsd.org
Subject:   RE: CPU context switching/load numbers
Message-ID:  <XFMail.20020502182330.jhb@FreeBSD.org>
In-Reply-To: <Pine.BSF.4.44.0205021530360.72136-100000@bemused.tcpns.com>

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

On 02-May-2002 Jason Borkowsky wrote:
> 
> 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.

This last bit is where you go wrong.  The 1.12 is just for the minute prior to
when you ran the command, it has no relation to any previous minutes.  Just
cause it is 1.12 right now doesn't mean the average load for every minute is
1.12.

> 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?

No, when a process is finished, it is always in the kernel (either to block on
a resource or to exit, or because an interrupt to force a time-slice kicked it
into the kernel) and it just does a context switch right then and there.

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

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?XFMail.20020502182330.jhb>