From owner-freebsd-current@FreeBSD.ORG Tue Aug 1 10:11:18 2006 Return-Path: X-Original-To: freebsd-current@FreeBSD.ORG Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6068B16A4DE for ; Tue, 1 Aug 2006 10:11:18 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [83.120.8.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id 76FD243D45 for ; Tue, 1 Aug 2006 10:11:17 +0000 (GMT) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (mlifor@localhost [127.0.0.1]) by lurza.secnetix.de (8.13.4/8.13.4) with ESMTP id k71ABAaO036858 for ; Tue, 1 Aug 2006 12:11:16 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.13.4/8.13.1/Submit) id k71ABA6n036857; Tue, 1 Aug 2006 12:11:10 +0200 (CEST) (envelope-from olli) Date: Tue, 1 Aug 2006 12:11:10 +0200 (CEST) Message-Id: <200608011011.k71ABA6n036857@lurza.secnetix.de> From: Oliver Fromme To: freebsd-current@FreeBSD.ORG In-Reply-To: <20060731191206.GE749@turion.vk2pj.dyndns.org> X-Newsgroups: list.freebsd-current User-Agent: tin/1.8.0-20051224 ("Ronay") (UNIX) (FreeBSD/4.11-STABLE (i386)) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Tue, 01 Aug 2006 12:11:16 +0200 (CEST) X-Mailman-Approved-At: Tue, 01 Aug 2006 11:37:50 +0000 Cc: Subject: Re: vmstat's entries type X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-current@FreeBSD.ORG List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2006 10:11:18 -0000 Peter Jeremy wrote: > John Baldwin wrote: > > Peter Jeremy wrote: > > > This approach still requires the reader to loop with something like > > > do { > > > a.lo = counter.lo; > > > a.hi = counter.hi; > > > b.lo = counter.lo; > > > b.hi = counter.hi; > > > } while (a.hi != b.hi || a.lo > b.lo); > > > to ensure that the reader doesn't read the middle of an update. > > > > Yes, but the idea here is that these stats are written to far more often than > > read, so it's ok to pessimize the read case. > > We are in violent agreement here. My point was that the reader has > to be aware of this requirement. I assume that there is only _one_ reader, e.g. a single function which performs the operations necessary to read the value. Everything else must use that function and need not care about the internals. So there is only one piece of code that has to be aware of the requirement. Regarding the argument "cheap vs. accurate": For simple statistics counters it is certainly acceptable if a single update is lost once in a while (i.e. if one out of 2^32 updates is lost). However, if an update to the overflow (upper 32 bits) is lost or erroneously doubled, it would mean a huge error of 2^32 at once. That's not acceptable, in my opinion. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. "What is this talk of 'release'? We do not make software 'releases'. Our software 'escapes', leaving a bloody trail of designers and quality assurance people in its wake."