(PECL mongo &gt;= 1.0.11)
Gets the process ID
@link http://php.net/manual/en/mongoid.getpid.php
@return int Returns the PID of the MongoId.
351693
public function getPID()
    {
        $id = (string) $this->objectID;

        // PID is stored as little-endian, flip it around
        $pid = substr($id, 16, 2) . substr($id, 14, 2);
        return hexdec($pid);
    }
880637
public static function redis()
    {
        // Detect when the PID of the current process has changed (from a fork, etc)
        // and force a reconnect to redis.
        $pid = getmypid();
        if (self::$pid !== $pid) {
            self::$redis = null;
            self::$pid   = $pid;
        }

        if(!is_null(self::$redis)) {
            return self::$redis;
        }

        $server = self::$redisServer;
        if (empty($server)) {
            $server = 'localhost:6379';
        }

        if(is_array($server)) {
            self::$redis = new RedisCluster($server);
        } else {
            if (strpos($server, 'unix:') === false) {
                list($host, $port) = explode(':', $server);
            } else {
                // $server is 'unix:/tmp/redis.sock'
                $host = $server;
                $port = null;
            }
            self::$redis = new Redis($host, $port);
            if (!empty(self::$redisPassword)) {
                self::$redis->auth(self::$redisPassword);
            }
        }

        self::$redis->select(self::$redisDatabase);
        return self::$redis;
    }
1198177
private static function getNodeId()
    {
        if (self::$hostIp !== null) {
            return ip2long(self::$hostIp);
        }

        self::$hostIp = '127.0.0.1';

        if (self::$hostName !== null) {
            self::$hostIp = crc32(self::$hostName);
        }

        if (true === function_exists('php_uname')) {
            self::$hostName = php_uname('n');
            self::$hostIp = gethostbyname(self::$hostName);
        }

        if (true === function_exists('gethostname')) {
            self::$hostName = gethostname();
            self::$hostIp = gethostbyname(self::$hostName);
        }

        return ip2long(self::$hostIp);
    }
771976
function getPPID () {
  const ppid = process.ppid

  if (typeof ppid === 'number') {
    return Promise.resolve(ppid)
  }

  return find('pid', process.pid)
    .then(list => {
      return list && list[0] && list[0].ppid
    })
}
1155206
private static String getPID() {
        String name = ManagementFactory.getRuntimeMXBean().getName();
        int index = name.indexOf('@');
        if (index == -1) {
            return null;
        }

        String pid = name.substring(0, index);
        if (!pid.matches("[0-9]+")) {
            return null;
        }

        return pid;
    }
348537
protected function getMasterPid()
    {
        $pidFile = $this->getPidPath();

        if (is_file($pidFile)) {
            $masterPid = (int) file_get_contents($pidFile);
        } else {
            $masterPid = 0;
        }

        return $masterPid;
    }
581184
public function getId()
    {
        return sprintf(
          '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
          mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff),
          mt_rand(0, 0x0fff) | 0x4000,
          mt_rand(0, 0x3fff) | 0x8000,
          mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
        );
    }
1271041
public function getPidFromUid($uid = 0)
    {
        $queryBuilder = self::getQueryBuilder();
        $triggerElement = $queryBuilder
            ->select('pid')
            ->from('tt_content')
            ->where(
                $queryBuilder->expr()->eq(
                    'uid',
                    $queryBuilder->createNamedParameter(abs($uid), \PDO::PARAM_INT)
                )
            )
            ->execute()
            ->fetch();
        $pid = (int)$triggerElement['pid'];
        return is_array($triggerElement) && $pid ? $pid : 0;
    }
15746
public function getRunningPID() {
        if (!file_exists($this->pidFile)) {
            return false;
        }

        $runPid = trim(file_get_contents($this->pidFile));
        if (!$runPid) {
            return false;
        }

        return $runPid;
    }
1001104
public static int getPid() {

		// format: "pid@hostname"
		String jvmName = ManagementFactory.getRuntimeMXBean().getName();
		String[] split = jvmName.split("@");
		if (split.length != 2) {
			return -1;
		}

		try {
			return Integer.parseInt(split[0]);
		} catch (Exception e) { // NOSONAR
			return -1;
		}
	}
1108280
public function getStatus() {
        if ($this->pid) {
            $waitPID = \pcntl_waitpid($this->pid, $status, WNOHANG);

            if ($waitPID == $this->pid) {
                return Thread::THREAD_EXITED;
            } else {
                return Thread::THREAD_RUNNING;
            }
        }
    }
1103676
private long getPID() {
        String commandOutput = executeCommand("$pid").getCommandOutput();

        //Remove all non numeric characters
        commandOutput = commandOutput.replaceAll("\\D", "");

        if (!commandOutput.isEmpty()) {
            return Long.valueOf(commandOutput);
        }

        return -1;
    }
647008
public static function workerPids()
    {
        $pids = [];
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
            exec('tasklist /v /fi "PID gt 1" /fo csv', $cmdOutput);
            foreach ($cmdOutput as $line) {
                $a = explode(',', $line);
                list(, $pids[],) = str_replace('"', '', explode(',', trim($line), 3));
            }
        } else {
            exec('ps -A -o pid,command | grep [r]esque', $cmdOutput);
            foreach ($cmdOutput as $line) {
                list($pids[],) = explode(' ', trim($line), 2);
            }
        }
        return $pids;
    }
897525
public function getLastInsID()
    {
        $id = $this->builder->getLastInsID();
        if ($id instanceof ObjectId) {
            $id = $id->__toString();
        }
        return $id;
    }
612665
protected function getPageId($pid)
    {
        $pid = (int)$pid;
        if ($pid > 0) {
            return $pid;
        }
        $row = BackendUtilityCore::getRecord('tt_content', abs($pid), 'uid,pid');
        return $row['pid'];
    }
671881
private function __getProcessOwner()
    {
        if (function_exists('posix_getpwuid')) {
            $a = posix_getpwuid(posix_getuid());

            return $a['name'];
        } else {
            $user = trim(exec('whoami', $o, $code));
            if ($code === 0) {
                return $user;
            }

            return false;
        }

        return false;
    }
1131939
public function getId()
    {
        return (strpos($this->__id, "[]") !== false) ? str_replace("[]", "", $this->__id) : $this->__id;
    }