Top


定義場所(file name)

hotspot/src/share/vm/runtime/os.cpp

説明(description)

// This is the working definition of a server class machine:
// >= 2 physical CPU's and >=2GB of memory, with some fuzz
// because the graphics memory (?) sometimes masks physical memory.
// If you want to change the definition of a server class machine
// on some OS or platform, e.g., >=4GB on Windohs platforms,
// then you'll have to parameterize this method based on that state,
// as was done for logical processors here, or replicate and
// specialize this method for each platform.  (Or fix os to have
// some inheritance structure and use subclassing.  Sigh.)
// If you want some platform to always or never behave as a server
// class machine, change the setting of AlwaysActAsServerClassMachine
// and NeverActAsServerClassMachine in globals*.hpp.

名前(function name)

bool os::is_server_class_machine() {

本体部(body)

  {- -------------------------------------------
  (1) 以下のどちらかが成り立てば true をリターンする. そうでなければ false をリターンする.

      * NeverActAsServerClassMachine オプションが指定されておらず, かつ
        AlwaysActAsServerClassMachine オプションが指定されている場合:

      * NeverActAsServerClassMachine オプションが指定されておらず, かつ
        以下の条件が全て満たされる場合:

        * プロセッサのコア数が 2個以上
          (なお, x86 の場合 SMT(HyperThreading) による論理コアではなく物理的なコア数を数えることに注意.
          See: VM_Version::logical_processors_per_package())
        * 物理メモリ量が 1792 MB 以上  
          (コメントによると, 
          本当は「2GB 以上」にしたいが, グラフィックボード等の関係で 
          256MB 位は見えないことがあるので少し小さくしている, 
          とのこと)
      ---------------------------------------- -}

      // First check for the early returns
      if (NeverActAsServerClassMachine) {
        return false;
      }
      if (AlwaysActAsServerClassMachine) {
        return true;
      }
      // Then actually look at the machine
      bool         result            = false;
      const unsigned int    server_processors = 2;
      const julong server_memory     = 2UL * G;
      // We seem not to get our full complement of memory.
      //     We allow some part (1/8?) of the memory to be "missing",
      //     based on the sizes of DIMMs, and maybe graphics cards.
      const julong missing_memory   = 256UL * M;

      /* Is this a server class machine? */
      if ((os::active_processor_count() >= (int)server_processors) &&
          (os::physical_memory() >= (server_memory - missing_memory))) {
        const unsigned int logical_processors =
          VM_Version::logical_processors_per_package();
        if (logical_processors > 1) {
          const unsigned int physical_packages =
            os::active_processor_count() / logical_processors;
          if (physical_packages > server_processors) {
            result = true;
          }
        } else {
          result = true;
        }
      }
      return result;
    }

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.