From owner-freebsd-hackers Thu May 2 14:53:43 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from tcpns.com (dsl-64-192-239-221.telocity.com [64.192.239.221]) by hub.freebsd.org (Postfix) with ESMTP id 157BD37B417 for ; Thu, 2 May 2002 14:53:32 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by tcpns.com (8.12.3/8.12.2) with ESMTP id g42LrVeP072376 for ; Thu, 2 May 2002 17:53:31 -0400 (EDT) Date: Thu, 2 May 2002 17:53:31 -0400 (EDT) From: Jason Borkowsky To: hackers@freebsd.org Subject: CPU context switching/load numbers Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 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