I have list of tasks that needs to be executed . Each task is a producer that updates multiple entities in response to consuming multiple entities. So tasks are dependent on each other for their execution. However, some producers are ok with consuming some or all of their entities stale. This should effectively makes sure there are no deadlocks.
How to design an execution graph in this case where: 1) Maximum number of tasks are run parallel (and) 2) Maximum number of tasks consume live/non-stale data
Any help is highly appreciate.
Editing after comments: Producer is able to tolerate stale data. This implies that any edge can be removed. So, there is always a solution (a DAG can be formed). This edge removed has a cost. So effectively the problem is:
Given a cyclic graph G (with root node and sink node), with operations - remove an edge between two nodes with cost C. How to create a DAG with maximum number of nodes at any level of node and with minimum cost. Here level is the depth from root nodes. If it takes two edges to reach a nodes from root, the level of node is 2. root node is at level '0'.