Scala performance FAQ: Is there a reliable way to determine the number of CPUs or cores on a computer?
Briefly

Use Runtime.getRuntime().availableProcessors() to determine the number of CPUs/cores. It reflects the actual cores available where the JVM is running.
The method is cross-platform and provides accurate information. Verified on a MacBook showing 12 cores, matching the system report.
Read at Alvinalexander
[
]
[
|
]