code: private double computeShare(JobInfo info, double w2sRatio,
        TaskType type, boolean considerMinMax) {
      if (!isRunnable(info)) {
        return 0;
      }
      double share = type == TaskType.MAP ? info.mapWeight : info.reduceWeight;
      share *= w2sRatio;
      if (considerMinMax) {
        int minSlots = type == TaskType.MAP ? info.minMaps : info.minReduces;
        share = Math.max(share, minSlots);
        int maxSlots = type == TaskType.MAP ? info.maxMaps : info.maxReduces;
        share = Math.min(share, maxSlots);
      }
      share = Math.min(share, runnableTasks(info, type));
      return share;
    }
docs: Compute the number of slots assigned to a job given a particular
  weight-to-slot ratio w2sRatio.