Dynamic reads without locking.
Harti Brandt
brandt at fokus.fraunhofer.de
Wed Oct 8 03:22:55 PDT 2003
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 at fokus.fraunhofer.de, harti at freebsd.org
More information about the freebsd-hackers
mailing list