From owner-freebsd-arch Wed Jan 2 19:51: 3 2002 Delivered-To: freebsd-arch@freebsd.org Received: from avocet.prod.itd.earthlink.net (avocet.mail.pas.earthlink.net [207.217.120.50]) by hub.freebsd.org (Postfix) with ESMTP id 5003037B41E; Wed, 2 Jan 2002 19:51:00 -0800 (PST) Received: from pool0067.cvx22-bradley.dialup.earthlink.net ([209.179.198.67] helo=mindspring.com) by avocet.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16Lyu8-00040M-00; Wed, 02 Jan 2002 19:50:56 -0800 Message-ID: <3C33D3E3.38E758CA@mindspring.com> Date: Wed, 02 Jan 2002 19:45:39 -0800 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Matthew Dillon Cc: Alfred Perlstein , John Baldwin , arch@FreeBSD.ORG, Bernd Walter , Mike Smith , Bruce Evans , Michal Mertl , Peter Jeremy Subject: Re: When to use atomic_ functions? (was: 64 bit counters) References: <200201030002.g0302Eo60575@apollo.backplane.com> <20020102180734.A82406@elvis.mu.org> <200201030012.g030Cgp60752@apollo.backplane.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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