Class CpuAffinity

java.lang.Object
org.apache.bookkeeper.common.util.affinity.CpuAffinity

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

    • 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.