Re: vmstat's entries type

From: Oliver Fromme <olli_at_lurza.secnetix.de>
Date: Tue, 1 Aug 2006 12:11:10 +0200 (CEST)
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."
Received on Tue Aug 01 2006 - 08:11:18 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:58 UTC