I'd suggest that it's about whether large chunks of work can be executed independently, in mostly-any order, without yielding different results. (Unless variations are acceptable or good.)
Three candidates I'd look for:
- Time-consuming iterations wherein processing order won't change the outcome.
- You discover
DoWork() needs to happen before you need the results.
- You discover
DoWork() needs to happen and you don't need results at all.
In all three cases, ensure that the impact on shared state is manageable or non-existent.
And, bear in mind that these are just candidates. You need to assess how much work needs to be done and how entangled (or non-tangled) that work is with all the other work the application could be doing. And, then you would ideally benchmark both solutions.
For example ...
A time-consuming iteration wherein processing order doesn't matter.
You have a massive
List<Int32> data for which you need to compute the average as fast as possible. Building an average is primarily addition, which is associative. So, we can perform the addition in Task-able chunks:
avg(data[0..z]) == ( sum(data[0..n]) + sum(data[n..m]) .. sum(data[x..z]) ) / data.Count;
(This can actually be broken down in a more sophisticated, cluster-capable manner; but, it's an example...)
I know that
DoWork() needs to happen before you need its results.
You're rendering a document. On that document, you have N components of various types (images, formatted text blocks, graphs, etc.). To simplify it, in this scenario, each component can render itself completely independently and return a graphical component to the LayoutEngine. And, the LayoutEngine needs to wait for each component to render and return its dimensions before it can position them and feed them to the DisplayEngine ... or whatever.
I don't need the results of
DoWork() at all.
Certain kinds of logging.
If you're logging application interactions to support marking efforts, for example, you might want to fire-and-forget about those logging events. If logging takes a long time or fails, you don't want to disrupt the operation or performance of the application.