code: private void updateFairShares(double totalSlots, final TaskType type) {
      // Find the proper ratio of (# of slots share / weight) by bineary search
      BinarySearcher searcher = new BinarySearcher() {
        @Override
        double targetFunction(double x) {
          return slotsUsedWithWeightToSlotRatio(x, type);
        }
      };
      double ratio = searcher.getSolution(totalSlots, lastWeightToFairShareRatio);
      lastWeightToFairShareRatio = ratio;
  
      // Set the fair shares based on the value of R we've converged to
      for (JobInfo info : infos.values()) {
        if (type == TaskType.MAP) {
          info.mapFairShare = computeShare(info, ratio, type);
        } else {
          info.reduceFairShare = computeShare(info, ratio, type);
        }
      }
    }
docs: Update fairshare for each JobInfo based on the weight, neededTasks and
  minTasks and the size of the pool. We compute the share by finding the
  ratio of (# of slots / weight) using binary search.