Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 Jan 2002 19:45:39 -0800
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        Alfred Perlstein <bright@mu.org>, John Baldwin <jhb@FreeBSD.ORG>, arch@FreeBSD.ORG, Bernd Walter <ticso@cicely8.cicely.de>, Mike Smith <msmith@FreeBSD.ORG>, Bruce Evans <bde@zeta.org.au>, Michal Mertl <mime@traveller.cz>, Peter Jeremy <peter.jeremy@alcatel.com.au>
Subject:   Re: When to use atomic_ functions? (was: 64 bit counters)
Message-ID:  <3C33D3E3.38E758CA@mindspring.com>
References:  <XFMail.020102152920.jhb@FreeBSD.org> <200201030002.g0302Eo60575@apollo.backplane.com> <20020102180734.A82406@elvis.mu.org> <200201030012.g030Cgp60752@apollo.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Matthew Dillon wrote:
>     If we standardize the mutex used by interface device-driver interrupts
>     (if it isn't already done), the collector could obtain the mutex when
>     reading the counter, yes?

IMO, statistics are snapshots in any case, so it doesn't
really matter if they are incredibly accurate on read.

In any case, multiple reader, single write doesn't need locks
unless it has to be done atomically.

An easy way to do this atomically, even for fairly large items,
is to toggle between an active and inactive structure of data,
where the pointer to the strucutre is assigned atomically.

I used this property for my zero system call gettimeofday(),
for example.

-- Terry

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C33D3E3.38E758CA>