3 ms·
What terminology do you use to describe something that is non-deterministic due to timing, but correct? I use 'race condition', but if you reserve that for som
by chrisseaton 7y ago
What terminology do you use to describe something that is non-deterministic due to timing, but correct?
I use 'race condition', but if you reserve that for something with bugs you'll need to invent a new term for the benign version.
- dnautics 7y agoSince pjc wanted a example that isn't explicitly a bug (a 'benign' race condition) I'll provide one that can be a major pita, two concurrent tasks are logging their event stream. Logs may not hit in exactly the order that you expect in your mind, forcing you to stop and think each time you're going over the logs. Definitely a race condition. Definitely expected behaviour. Not sure you can call that a bug. More than once in my life I have thought that this was a bug, tried to correct it, and introduced another bug, followed by teeth gnashing, hair pulling, swearing, and then a revert.
- amenod 7y ago> ...is generally called "lock free"
- chrisseaton 7y agoNo that doesn't always apply. Think of two worker threads pushing entires to a synchronised log. It's non-deterministic which order they arrive in the log, as different schedulings and other things will cause the threads to run in different orders (they 'race' to put entries in the log, we say), but it's not a bug, and it's not lock-free because the log is synchronised.
- pjc50 7y ago> What terminology do you use to describe something that is non-deterministic due to timing, but correct? "Non-deterministic" works? However, I'm arguing that nondeterministic results from deterministic input are themselves a mild form of bug, like a compiler warning or "code smell". Perhaps we also have to talk about causality and serialisability, clocks and timestamping. In a concurrent or distributed system it may not be easy to determine what order things happen in without unreasonable effort or performance impairment, but if so the system has to be designed so that doesn't matter. > Think of two worker threads pushing entires to a synchronised log. It's non-deterministic which order they arrive in the log, as different schedulings and other things will cause the threads to run in different orders (they 'race' to put entries in the log, we say), but it's not a bug, and it's not lock-free because the log is synchronised. Those I would call independent. Unless they're acting on something in common, in which case having the transactions serialised as A before B then logged as B before A is immensely annoying.
- deleted 7y ago[deleted]
- lostcolony 7y ago"Non-deterministic" totally works, but it's not necessarily a bug or even a code smell even if deterministic inputs lead to non-deterministic results. The order a series of parallel network calls returns is non-deterministic, for instance, but hardly a bug. Otherwise, yes, agreed on all counts. It's telling that even when posing the question of what other term to use besides race condition, the op used 'non-deterministic'.