voddan
05/29/2018, 2:17 PMelizarov
05/30/2018, 8:33 AMExecutors.newFixedThreadPool(n).asCoroutineDispatcher()
does not work for you?voddan
05/30/2018, 12:00 PM[[a1, b1, c1], [a2, b2, c2], [a3, b3, c3], ...]
, each stage is a roughly equivalent expensive CPU computation.ScheduledThreadPoolExecutor
the system will execute task stages in order of their submission: a1, a2, a3, a4, ..., b1, b2, b3, ..., c1, c2, ...
. Note that when (N >> 1) tasks come simultaneously, all of them will progress through stages "in-parallel" and finish at about the same time. In other worlds, the time it takes to complete 1st task (a1, b1, c1
) is O(N) in this scenarioa1, b1, c1
takes about the same for any N. That can happen if our scheduler has a higher priority for earlier tasks, so it never executes a3
if it can execute c1
instead. Makes sense?elizarov
05/30/2018, 3:55 PMvoddan
06/04/2018, 7:39 AMelizarov
06/04/2018, 11:55 AM