Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5048379

API for obtaining low-level CPU information (e.g., socket count and CPU model)

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • None
    • 1.4.2_06, 6u22
    • core-libs
    • x86
    • windows_2000, windows_xp

      The following code when run on Windows platform, normally returns the correct
      results. But when we use the intel's hyperthreading then it returns twice the
      number of processors available.

      The reason is that java.lang.Runtime.availableProcessors() is returning the
      number of logical processors, rather than the physical ones.

      import java.lang.Runtime.*;

      public class FindProcessor
      {
          public static void main(String argv[]) {
      Runtime rt = java.lang.Runtime.getRuntime();
      System.out.println("The available processors are " +
                  rt.availableProcessors());

          }

      }

            Unassigned Unassigned
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: