code: private void updateSlotLimit(
        final Pool pool, final TaskType type, LimitType limitType) {
      if (poolMgr.fifoWeight(pool.getName())) {
        updateSlotLimitFifo(pool, type, limitType);
        return;
      }
      // Find the proper ratio of (# of minSlots / weight) by bineary search
      BinarySearcher searcher = new BinarySearcher() {
        @Override
        double targetFunction(double x) {
          return poolSlotsUsedWithWeightToSlotRatio(pool, x, type, false);
        }
      };
      int total = getPoolSlotLimit(pool, type, limitType);
      double lastRatio = getLastRatio(pool, limitType);
      double ratio = searcher.getSolution(total, lastRatio);
      setLastRatio(pool, limitType, ratio);
  
      int leftOver = total;
      List<JobInfo> candidates = new LinkedList<JobInfo>();
      for (JobInProgress job : pool.getJobs()) {
        JobInfo info = infos.get(job);
        if (info == null) {
          throw new IllegalStateException("Couldn't find job " + job.jobId +
              " in pool " + pool.getName());
        }
        candidates.add(info);
        if (leftOver == 0) {
          setSlotLimit(info, 0, type, limitType);
        }
        int slots = (int)Math.floor(computeShare(info, ratio, type, false));
        if (leftOver >= slots) {
          leftOver -= slots;
          setSlotLimit(info, slots, type, limitType);
        }
      }
      // Assign the left over slots in round-robin order
      for (int i = 0; i < leftOver && !candidates.isEmpty(); ++i) {
        JobInfo info = candidates.remove(0);
        if (incSlotLimit(info, type, limitType)) {
          candidates.add(info);
        }
      }
    }
docs: Compute the min/max slots for each job. This is done by distributing the
  configured min/max slots of each pool to the jobs inside that pool.