Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Oct 2003 11:12:51 +0100
From:      Bruce M Simpson <bms@spc.org>
To:        Harti Brandt <brandt@fokus.fraunhofer.de>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Dynamic reads without locking.
Message-ID:  <20031008101251.GG6524@saboteur.dek.spc.org>
In-Reply-To: <20031008114506.I63940@beagle.fokus.fraunhofer.de>
References:  <20031008083059.GA520@garage.freebsd.pl> <20031008114506.I63940@beagle.fokus.fraunhofer.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Oct 08, 2003 at 11:51:06AM +0200, Harti Brandt wrote:
> You need to lock when reading if you insist on consistent data. Even a
> simple read may be non-atomic (this should be the case for 64bit
> operations on all our platforms).

Or keep a generation count to detect pre-emption (the devstat code does
this, amongst other things), and try again if you lost the race.

Or insist on atomic reads, which must complete and must not be pre-empted
by definition (although the SMP case is/can be different!).

BMS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031008101251.GG6524>