code: static boolean checkPidPgrpidForMatch(String pidStr, String procfsDir) {
      Integer pId = Integer.parseInt(pidStr);
      // Get information for this process
      ProcessInfo pInfo = new ProcessInfo(pId);
      pInfo = constructProcessInfo(pInfo, procfsDir);
      if (pInfo == null) {
        // process group leader may have finished execution, but we still need to
        // kill the subProcesses in the process group.
        return true;
      }
  
      //make sure that pId and its pgrpId match
      if (!pInfo.getPgrpId().equals(pId)) {
        LOG.warn("Unexpected: Process with PID " + pId +
                 " is not a process group leader.");
        return false;
      }
      if (LOG.isDebugEnabled()) {
        LOG.debug(pId + " is a process group leader, as expected.");
      }
      return true;
    }
docs: Verify that the given process id is same as its process group id.
  @param pidStr Process id of the to-be-verified-process
  @param procfsDir  Procfs root dir