Dynamic reads without locking.

Pawel Jakub Dawidek nick at garage.freebsd.pl
Fri Oct 10 01:22:27 PDT 2003


On Thu, Oct 09, 2003 at 12:46:44PM -0700, Jeffrey Hsu wrote:
+> This case (along with some other cases where locks of atomic reads
+> are required) is covered in the paper as
+> 
+>   But, one case where locks would be required is if the field
+>   temporarily holds a value that no one else is supposed to see and
+>   the writer, operating with the lock held, will store a valid value
+>   before releasing his lock. In this case, both the writer and
+>   reader need to hold the lock before accessing this field.

This isn't trivial problem for me, because:
1. Are we permitted to don't use locks while atomic read if it depends
   on writter, not on reader? If I'm adding variable modification and
   this modification have to be safe, I've to check every read of this
   variable and add locks everywhere. This order isn't quite correct.
2. If there is a chance for race while writting data not-atomically
   why we only permit atomic reads? In atomic vs. not-atomic read only
   probability of race is smaller, but it is still there.

-- 
Pawel Jakub Dawidek                       pawel at dawidek.net
UNIX Systems Programmer/Administrator     http://garage.freebsd.pl
Am I Evil? Yes, I Am!                     http://cerber.sourceforge.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 305 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20031010/91f64c64/attachment.bin


More information about the freebsd-hackers mailing list