correction
This commit is contained in:
parent
dab09d6657
commit
c18ccf1e43
|
@ -21,7 +21,7 @@ is better suited to independent tasks because ...".
|
|||
|
||||
`ThreadPoolExecutor` is better suited for long running tasks, because `join()` executes another task while waiting for the current one to finish, therefore possibly waiting longer than strictly necessary.
|
||||
|
||||
`ForkJoinPool` is better suited for short running tasks because it creates less synchronization overhead than `ThreadPoolExecutor` and it uses a stack instead of a FiFo Queue to allow the newest tasks to be executed first (which also makes it better suited for mutually dependent tasks, since the waiting time for `join()`ing tasks is minimized)
|
||||
`ForkJoinPool` is better suited for short running tasks because it uses seperate stacks for each thread, therefore avoiding synchronization overhead when taking new tasks.
|
||||
|
||||
Tasks usually create other tasks if they are dependent on that task, so since `ForkJoinPool` is better suited for mutually dependent tasks, it is also better suited for tasks that create other tasks.
|
||||
|
||||
|
|
|
@ -10,11 +10,8 @@ import java.util.concurrent.ExecutionException;
|
|||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.concurrent.ForkJoinTask;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.RecursiveAction;
|
||||
import java.util.concurrent.RecursiveTask;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
/**
|
||||
* Construct a binary tree and compute the sum over all tree nodes
|
||||
|
|
Loading…
Reference in New Issue