Dynamic reads without locking.

Bruce M Simpson bms at spc.org
Wed Oct 8 03:13:12 PDT 2003


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


More information about the freebsd-hackers mailing list