From owner-freebsd-hackers Thu May 2 15:23:50 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.speakeasy.net (mail13.speakeasy.net [216.254.0.213]) by hub.freebsd.org (Postfix) with ESMTP id E0D5C37B41E for ; Thu, 2 May 2002 15:23:38 -0700 (PDT) Received: (qmail 26225 invoked from network); 2 May 2002 22:23:37 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail13.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 2 May 2002 22:23:37 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.11.6/8.11.6) with ESMTP id g42MNaF09216; Thu, 2 May 2002 18:23:36 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: Date: Thu, 02 May 2002 18:23:30 -0400 (EDT) From: John Baldwin To: Jason Borkowsky Subject: RE: CPU context switching/load numbers Cc: hackers@freebsd.org Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 <>< 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