Comment Re:What universe does this guy live in? (Score 1) 189
>Synchronisation is normally used to provide consistency of the shared resource but not often used to provide overall ordering with regards to accessing it.
>Hence non determinism. If you can't tell which thread gets to access the shared resource and in which order, the program is no longer deterministic.
I am really struggling to imagine a situation where you need to determine ahead of time the order in which a number
of threads need to access a shared resource in.
If the thing needs to be accessed in a specific order, then doesn't it mean that you should just have one thread
operating on that data, since it's by nature a sequential process, no?
The other scenario is where an item might be transitioned to different states as it's changed by, e.g. the result of
some async io (quite a common scenario). But then you use a state engine to ensure that the thing is in a determined
state at all times - and you never care about which thread's going to access it next because every thread should
be capable of moving the item forward to its desired end-state.
>If you can't tell which thread gets to access the shared resource and in which order
If you need to set the order in which threads are accessing a resource, I think somewhere you're doing
it very wrong. But if you have a specific example of where that's necessary I'd love to hear it.