3 ms·
A race condition is a set of (possibly very many) very well defined states - or at least defined as well as everything else in the program. Someone should disco
by klibertp 13y ago
A race condition is a set of (possibly very many) very well defined states - or at least defined as well as everything else in the program. Someone should discover some algebra for working with concurrent processes and the race conditions would go away!
(the second sentence is a joke.)
- dllthomas 13y agoAmbiguity is quite frequently between several well-defined states. A significant difference between race conditions and natural language ambiguity is that in the latter we typically expect resolution to happen favorably when the interaction is cooperative - which is not a feature of race conditions in the general or typical case. I think it's still fair to say that this is not an essential feature of ambiguity, though, which is why I included it as an example. In the case of a race condition, the relevant pieces of the language do not uniquely define a single result - additional context may.
- bcoates 13y agoA simple data race in C11/C++11 is undefined behavior, it doesn't have to result in any well-defined state that you might get by interleaving the execution of threads. I think this has been on HN already: http://www.hpl.hp.com/personal/Hans_Boehm/c++mm/why_undef.html http://www.hpl.hp.com/personal/Hans_Boehm/c++mm/why_undef.ht... Essentially it has to be that way, or on some architectures every access to a potentially shared variable would have to be wrapped in fences by the compiler.
- dllthomas 13y agoStrictly speaking, it could be implementation-defined behavior.