Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Stray away from this model (e.g., relaxed atomics)

Relaxed atomics are still data-race free, did you mean non-atomic accesses?



I should clarify slightly. There are multiple definitions of "data race" in play. In the sense of the C/C++ standard, where a data race is essentially used to describe behaviors that are undefined, relaxed atomics are free of data races. However, from the perspective of a data-race-free model where data races are things that observably violate sequential consistency, relaxed atomics are absolutely data races.

In fact, the raison d'être for relaxed atomics is to permit applications to create "benign data races" [in the second sense] that aren't undefined behavior. As it turns out, though, actually specifying what semantics such a "benign data race" has is complicated, especially when you get into the realm of avoiding things like out-of-thin-air behavior (or, to reference a paper that crossed my desk a month ago, undefined behavior executed only if out-of-thin-air happens).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: