0

Does the following require some kind of synchronization?

Control Worker 1 Worker 2 ... Worker n
Test if all a_n is true. If so, dispatch a new job. Otherwise, try again. when done: set a_1 to true when done: set a_2 to true ... when done: set a_n to true

The test performed by the control thread is not atomic. However, a_n can never be set to false. Thus, it is guaranteed that all a_n will be true for some iteration in the control thread. Is synchronization still necessary?

This control flow is used to process jobs in a graph. All tasks is stored in a linked list. When all $a_{kn}$ are true, job $k$ is dispatched and removed from the list. If they are not, try $a_{k+1}$. When the end of the list is reached, start over from the beginning of the list. Continue until the list is empty.

Note: I assume that the graph is a DAG.

user877329
  • 6,717
  • 8
  • 46
  • 88

0 Answers0