diff --git a/u08-1/README.md b/u08-1/README.md index 826a956..160a024 100644 --- a/u08-1/README.md +++ b/u08-1/README.md @@ -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. diff --git a/u08-2/TreeSumSequential.java b/u08-2/TreeSumSequential.java index 7f10dfb..46c1093 100644 --- a/u08-2/TreeSumSequential.java +++ b/u08-2/TreeSumSequential.java @@ -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