public class ProcessorInfo
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static int |
availableProcessors()
Returns the number of processors available to this process.
|
static void |
main(java.lang.String[] args) |
public static int availableProcessors()
Runtime.availableProcessors(). However, before Java 10, under Linux this strategy
is insufficient, since the JVM does not take into consideration the process' CPU set affinity and the CGroups
quota/period assignment. Therefore this method will analyze the Linux proc filesystem
to make the determination. Since the CPU affinity of a process can be change at any time, this method does
not cache the result. Calls should be limited accordingly.
public static void main(java.lang.String[] args)