tearor::TearCell is a “thread safe” cell which downgrades data races into data corruption.
As bad as the idea is, I appreciate the effort put into finding out “but how bad is it really? How bad can we make it while still technically being correct?”
Technically it converts data races into race conditions (which are likely to be perceived as data corruption.) This is a good illustration of data race freedom not automatically implying freedom from race conditions, a point that the “fearless concurrency” phrasing sort of glosses over (which is not to detract from data race freedom)
I haven’t done an in-depth comparison, but it seems to be the default approach of Java’s memory/object model, without some form of synchronization - that is, a field may only be observable as a value, that was previously set (not guaranteed that it’s the “latest”).
I have written a toy JVM in rust, and for that I used a pretty similar approach (though not as generic as the author’s) for objects’ memory layout/access, as to reply to the last paragraph of the post.
The author had me sold at:
As bad as the idea is, I appreciate the effort put into finding out “but how bad is it really? How bad can we make it while still technically being correct?”
Technically it converts data races into race conditions (which are likely to be perceived as data corruption.) This is a good illustration of data race freedom not automatically implying freedom from race conditions, a point that the “fearless concurrency” phrasing sort of glosses over (which is not to detract from data race freedom)
this sounds like exactly what you want to use to implement seqlocks
I haven’t done an in-depth comparison, but it seems to be the default approach of Java’s memory/object model, without some form of synchronization - that is, a field may only be observable as a value, that was previously set (not guaranteed that it’s the “latest”).
I have written a toy JVM in rust, and for that I used a pretty similar approach (though not as generic as the author’s) for objects’ memory layout/access, as to reply to the last paragraph of the post.