Growing111 / Growing111.github.io

This is my blog! https://growing111.github.io/archives/
2 stars 0 forks source link

多线程之ForkJoinPool | Liuy #13

Open Growing111 opened 5 years ago

Growing111 commented 5 years ago

https://growing111.github.io/2019/01/10/%E5%A4%9A%E7%BA%BF%E7%A8%8B%E4%B9%8BForkJoinPool/#more

原理 ForkJoinPool是jdk7新加的用法,它的优势在于充分的利用cpu,采用工作窃取算法,将一个大任务根据阈值分割成很多个子任务,最后根据场景是否要合并子任务运算结果。 构造12345678910111213141516public ForkJoinPool() { this(Math.min(MAX_CAP, Runtime.getRuntime().avai