Class CpuAffinity


  • public final class CpuAffinity
    extends java.lang.Object
    Utilities for enabling thread to CPU affinity.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void acquireCore()
      Acquire ownership of one CPU core for the current thread.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • acquireCore

        public static void acquireCore()
        Acquire ownership of one CPU core for the current thread.

        Notes:

        1. This method will only consider CPUs that are "isolated" by the OS. Eg: boot the kernel with isolcpus=2,3,6,7 parameter
        2. This method will disable hyper-threading on the owned core
        3. Once a thread successfully acquires a CPU, ownership will be retained, even if the thread exits, for as long as the JVM process is alive.