A polynomial algorithm to optimally schedule tasks on a virtual distributed system under tree-like precedence constraints