2 ms·
> Java and C# are mentioned as MSLs and yet they totally let you race. In Java a data race means loss of sequential consistency. Humans generally don't underst
by tialaramex 1y ago
> Java and C# are mentioned as MSLs and yet they totally let you race.
In Java a data race means loss of sequential consistency. Humans generally don't understand programs which lack sequential consistency so a typical Java team probably can't debug the program, but the program still always has well defined behaviour - and chances are you don't want to debug the weird non-sequentially consistent behaviour anyway, you just want them to fix the data race.
In C# data races are not too dangerous for trivial objects which are valid for all bit patterns. If you race an integer k, well, now k is smashed, don't think too hard about the value of k, it does have some value but it won't go well for you to try to reason about the value. For a complex object like a hash table, it's Undefined Behaviour.
Meanwhile in C or C++ all data races are immediate UB, you lose, game over.
- tialaramex 1y agoUgh, I guess my brain mis-fired when I wrote this originally. Sorry about that. The above C# comments (about trivial versus complex objects) actually refer to Go, a quite different garbage collected language. For C# the exact situation is not well documented, and so it's probably best not to rely on anything that you can't get a solid guarantee for, but in principle it's similar to Java.
- pizlonator 1y agoIn Fil-C, data races have Java-like behavior. The reason why YOLO-C has the bad data race behavior is because (1) data races might lead to memory safety violations and (2) the compiler is permitted to play more fast and loose than strictly necessary. Fil-C fixes (1) by making the language memory safe. Fil-C fixes (2) by just having different policies in the compiler.