While processing parallel streams JVM spins up number of threads equal to number of cores. How does the number of logical CPUs impact the performance? Does the degree of parallelism increase with the number of logical CPUs just like number of cores?
Asked
Active
Viewed 143 times
1
-
It actually creates a pool with N-1 threads and adds the current thread to the pool. – Peter Lawrey Jul 17 '18 at 06:15
-
Higher degrees of parallelism can give you access to more CPU. Whether you are using it or not is another question. – Peter Lawrey Jul 17 '18 at 06:16
1 Answers
3
java.util.stream.Stream
is an interface and the API contract does not specify how parallel streams should be parallelized.
The most commonly used OpenJDK implementation currently happens to use the ForkJoin common pool, except when it does not.

the8472
- 40,999
- 5
- 70
- 122