Date: Thu, 3 Jan 2002 10:42:39 +0100 From: Bernd Walter <ticso@cicely9.cicely.de> To: Terry Lambert <tlambert2@mindspring.com> Cc: Matthew Dillon <dillon@apollo.backplane.com>, 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: <20020103094239.GH53199@cicely9.cicely.de> In-Reply-To: <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> <3C33D3E3.38E758CA@mindspring.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 02, 2002 at 07:45:39PM -0800, Terry Lambert wrote: > 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. Single write means always with the same CPU or thread. If you always write with the same CPU the other might keep an old value in his cache for an unknown long time. You simply trust that caches gets syncronised automaticaly by regular events like context switching. I'm not shure this is valid. > 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. Only you use rel/acq behavour - atomic alone isn't strong enough. > I used this property for my zero system call gettimeofday(), > for example. -- B.Walter COSMO-Project http://www.cosmo-project.de ticso@cicely.de Usergroup info@cosmo-project.de 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?20020103094239.GH53199>