Rec 09

Problems

1. ForkJoinPool Example

  1. When a current workder hits task.join(), the current worker will become idle.

2. Difference between fork(), join() and compute()

task.fork() will actually let task to be completed by another worker.

f1.fork();
int a = f2.compute();
int b = f1.join();
return a + b;

The task forks f1 for another worker to complete, while completing f2 by itself in the meantime.

Last updated