From owner-freebsd-questions@FreeBSD.ORG Sun May 24 09:07:34 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 359D7106564A for ; Sun, 24 May 2009 09:07:34 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (gate6.infracaninophile.co.uk [IPv6:2001:8b0:151:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 8D13E8FC0A for ; Sun, 24 May 2009 09:07:33 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.3/8.14.3) with ESMTP id n4O97PdN062629; Sun, 24 May 2009 10:07:26 +0100 (BST) (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: Sendmail DKIM Filter v2.8.2 smtp.infracaninophile.co.uk n4O97PdN062629 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infracaninophile.co.uk; s=200708; t=1243156047; bh=wBTT8ryg8QLPXX0Ckk7xXy0/nmuiMMs+Y5rRFEHL7w4=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Cc:Content-Type:Date:From:In-Reply-To: Message-ID:Mime-Version:References:To; z=Message-ID:=20<4A190E47.6080006@infracaninophile.co.uk>|Date:=20S un,=2024=20May=202009=2010:07:19=20+0100|From:=20Matthew=20Seaman= 20|Organization:=20Infracaninophi le|User-Agent:=20Thunderbird=202.0.0.21=20(X11/20090420)|MIME-Vers ion:=201.0|To:=20Glen=20Barber=20|CC:=20f reebsd-questions@freebsd.org|Subject:=20Re:=20How=20can=20this=20' top'=20command=20output=20make=20sense?=20Load=20over=207=20and=0D =0A=20=09total=20CPU=20use=20~5%|References:=20<4A18BEC8.5060506@r awbw.com>=09=20<4A18FB5B.4080902@infracaninophile.co.uk>=20<4ad871 310905240112n6186631awd96599ab51886506@mail.gmail.com>|In-Reply-To :=20<4ad871310905240112n6186631awd96599ab51886506@mail.gmail.com>| X-Enigmail-Version:=200.95.6|Content-Type:=20multipart/signed=3B=2 0micalg=3Dpgp-sha256=3B=0D=0A=20protocol=3D"application/pgp-signat ure"=3B=0D=0A=20boundary=3D"------------enig34D09B1C3A50F8CD2536B9 6F"; b=BKhMTCKW0Yd9yBKf3UZlxBlENu48Z8PIqRko+NwsZ+XkkmOdWdfhxBI3ClBvv8Rq5 aOWZXygKArnXU4zTYxhTo443Mlt0AQHLYs7kLSob677lM18FXV8ByaOLvJyIDrfa1Z B9gqKoMl2qGe/NmzojmtV75YaXrX3vN6NvTqFdlU= X-Authentication-Warning: happy-idiot-talk.infracaninophile.co.uk: Host localhost [IPv6:::1] claimed to be happy-idiot-talk.infracaninophile.co.uk Message-ID: <4A190E47.6080006@infracaninophile.co.uk> Date: Sun, 24 May 2009 10:07:19 +0100 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 2.0.0.21 (X11/20090420) MIME-Version: 1.0 To: Glen Barber References: <4A18BEC8.5060506@rawbw.com> <4A18FB5B.4080902@infracaninophile.co.uk> <4ad871310905240112n6186631awd96599ab51886506@mail.gmail.com> In-Reply-To: <4ad871310905240112n6186631awd96599ab51886506@mail.gmail.com> X-Enigmail-Version: 0.95.6 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig34D09B1C3A50F8CD2536B96F" X-Virus-Scanned: clamav-milter 0.95.1 at happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VERIFIED,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on happy-idiot-talk.infracaninophile.co.uk Cc: freebsd-questions@freebsd.org Subject: Re: How can this 'top' command output make sense? Load over 7 and total CPU use ~5% X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 09:07:34 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig34D09B1C3A50F8CD2536B96F Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Glen Barber wrote: > Hi, Matthew >=20 > On Sun, May 24, 2009 at 3:46 AM, Matthew Seaman > wrote: >> Yuri wrote: >=20 > [snip] >=20 >> Sure. This is not an uncommon occurrence really. The load average is >> the number of processes in the queue for a CPU time slice averaged ove= r >> 5, 10 or 15 minutes. For multi-core systems the LA is scaled by the n= umber >> of cores so a LA of 1.0 means all cores have active processes pretty m= uch >> continually. >> >=20 > I thought, if it was a dual-core for example, a load average of 1.00 > would indicate 50% CPU utilization overall (1 process using only 1 > core)[1]. 2.00 on a dual-core would be 100%, 3.00 on a dual-core > would be 100% utilization, and always 1 process in the wait queue, and > so on. It seems both ways have been used in different OSes, which is confusing. A quick test of a single threaded process that will spin one CPU on a multi-core FreeBSD box shows the value is /not/ scaled by the number of c= ores. Which means that the LA the OP was talking about is actually a lot less a= larming than it originally appears. It's clear from the top output that his mach= ine has at least 8 cores, so a LA of 7 is really not very heavily loaded. >> Now, you might think that an active process will take the CPU utilisat= ion >> to 100%, but that is not necessarily so. Some numerical applications = can >> do that, but purely CPU bound processes are relatively uncommon in eve= ryday >> usage. In actuality what happens is that the processor will need to >> retrieve >> data from somewhere to operate on. There's a hierarchy of data stores= of >> various speeds (latency, rather than bandwidth): >> >> L1 Cache > L2 Cache > L3 Cache > Main RAM > Disk > Network >> >=20 > Does this affect the load average though? My understanding was that > if the CPU cannot immediately process data, the data gets put into the > wait queue until L2 Cache (then RAM, etc, etc) returns the data to be > processed. Yes it does: when a process is on the CPU and blocked waiting for IO it does not necessarily yield the CPU to another process. It depends on timescales -- obviously if the CPU will have to wait milliseconds for dat= a it makes no sense to block other processes. Waiting a few microseconds i= s a different matter though: it might take that long to load up L2/L3 cache= with that processes' working data, so yielding the CPU for that sort of d= elay would mean the process never got run, which is counter productive... It helps if the working set is already in the L3 cache -- so having the corr= ect amount[*] of cache RAM available is an important design criterion. It's = something that Intel was shown to have got wrong with some of the Pentium series ch= ips when a low powered Pentium M designed for mobile use smoked a much higher= clock speed Pentium chip designed for all-out server use simply because i= t had about 4x as much cache. Cheers, Matthew [*] ie. as much as possible. --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW --------------enig34D09B1C3A50F8CD2536B96F Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEAREIAAYFAkoZDk0ACgkQ8Mjk52CukIwQGACeJpPI3T5mjoJNi230nUl955SW LkQAnjYsfZbseoMsyyIgN5MzdnMf3fbI =ehSj -----END PGP SIGNATURE----- --------------enig34D09B1C3A50F8CD2536B96F--