Simulating a sequence of events concurrently subject to a happened-before partial order
Try identifying all dependencies between actions, then build a DAG that represents the dependencies: each vertex is an action, each edge is a dependency between two actions.  From this you can identify how to perform the maximum number of actions in parallel.  Basically, the algorithm is:


Find all the sources.  Perform all of those actions at once.
Delete all of those sources, and the edges going out of them.
Go back to step 1.


A source is a vertex with in-degree zero, i.e., with no edges entering into it.  In your context, it will be an action all of whose dependencies have been satisfied.

For instance, if action 1 must occur before action 2, which must occur before action 4, and action 3 must occur before action 4, the resulting order you get using this algorithm is: first actions 1 + 3 are performed (because they are the two sources); then action 2; then action 4.