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

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 8 Oct 2003, Bruce M Simpson wrote:

BMS>On Wed, Oct 08, 2003 at 11:51:06AM +0200, Harti Brandt wrote:
BMS>> You need to lock when reading if you insist on consistent data. Even a
BMS>> simple read may be non-atomic (this should be the case for 64bit
BMS>> operations on all our platforms).
BMS>
BMS>Or keep a generation count to detect pre-emption (the devstat code does
BMS>this, amongst other things), and try again if you lost the race.
BMS>
BMS>Or insist on atomic reads, which must complete and must not be pre-empted
BMS>by definition (although the SMP case is/can be different!).

That does not help if the writes are semantically not atomic:

foo = data;
foo &= mask;

harti
-- 
harti brandt,
http://www.fokus.fraunhofer.de/research/cc/cats/employees/hartmut.brandt/private
brandt@fokus.fraunhofer.de, harti@freebsd.org



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