ForkJoinPool seems to waste a thread

前端 未结 2 1361
一向
一向 2020-12-10 16:52

I\'m comparing two variations on a test program. Both are operating with a 4-thread ForkJoinPool on a machine with four cores.

In \'mode 1\', I use the pool very muc

2条回答
  •  南笙
    南笙 (楼主)
    2020-12-10 17:54

    ForkJoinTask.invokeAll is forking all tasks, but the first in the list. The first task it runs itself. Then it joins other tasks. It's thread is not released in any way to the pool. So you what you see, it it's thread blocking on other tasks to be complete.

提交回复
热议问题