public static String getProcessId() {
    return ManagementFactory.getRuntimeMXBean().getName().split("@")[0];
  }
There exists no platform-independent way that can be guaranteed to work in all jvm
implementations. ManagementFactory.getRuntimeMXBean().getName() looks like the best solution,
and typically includes the PID. On linux+windows, it returns a value like "12345@hostname"
(12345 being the process id).

@return process id of running Java virtual machine
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/utils/ProcessIdUtils.java