In some cases, we want to lower the priority of long-running tasks, (especially for CPU bound tasks). We can implement a task queue with multi-level feedback queue scheduling algorithm to solve the problem.
The queue itself cannot solve the whole problem. Unlike languages with runtime like Go, here we need task itself to interrupt itself give back the controllership to the thread pool. We should also provide a convenient way for Futures to interrupt itself once.
In some cases, we want to lower the priority of long-running tasks, (especially for CPU bound tasks). We can implement a task queue with multi-level feedback queue scheduling algorithm to solve the problem.
The queue itself cannot solve the whole problem. Unlike languages with runtime like Go, here we need task itself to interrupt itself give back the controllership to the thread pool. We should also provide a convenient way for Futures to interrupt itself once.