os::distribute_processes(uint length, uint* distribution)

  • プロセッサにプロセスを割り当てる。
  • LinuxWindows版では実装されていない。Solaris版では実装されている。
//Linux版(jdk7/hotspot/src/os/linux/vm/os_linux.cpp)
Bool os::distribute_processes(uint length, uint* distribution) {
  // Not yet implemented.
  return false;
}

ちなみにSolaris版はこんな感じ。psetというのはプロセッサセット。

//Solaris版(jdk7/hotspot/src/os/solaris/vm/os_solaris.cpp)
bool os::distribute_processes(uint length, uint* distribution) {
  bool result = false;
  // Find the processor id's of all the available CPUs.
  processorid_t* id_array  = NULL;
  uint           id_length = 0;
  // There are some races between querying information and using it,
  // since processor sets can change dynamically.
  psetid_t pset = PS_NONE;
  // Are we running in a processor set?
  if ((pset_bind(PS_QUERY, P_PID, P_MYID, &pset) == 0) && pset != PS_NONE) {
    result = find_processors_in_pset(pset, &id_array, &id_length);
  } else {
    result = find_processors_online(&id_array, &id_length);
  }
  if (result == true) {
    if (id_length >= length) {
      result = assign_distribution(id_array, id_length, distribution, length);
    } else {
      result = false;
    }
  }
  if (id_array != NULL) {
    FREE_C_HEAP_ARRAY(processorid_t, id_array);
  }
  return result;
}