code: protected synchronized int[] getMaxMapAndReduceLoad(int localMaxMapLoad,
        int localMaxReduceLoad) {
      // Approximate because of concurrency
      final int numTaskTrackers =
        taskTrackerManager.getClusterStatus().getTaskTrackers();
      /* Hold the result */
      int maxMapLoad = 0;
      int maxReduceLoad = 0;
      int neededMaps = 0;
      int neededReduces = 0;
      Collection<JobInProgress> jobQueue =
        jobQueueJobInProgressListener.getJobQueue();
      synchronized (jobQueue) {
        for (JobInProgress job : jobQueue) {
          if (job.getStatus().getRunState() == JobStatus.RUNNING) {
            neededMaps += job.desiredMaps() - job.finishedMaps();
            neededReduces += job.desiredReduces() - job.finishedReduces();
          }
        }
      }
      if (numTaskTrackers > 0) {
        maxMapLoad = Math.min(localMaxMapLoad, (int) Math
            .ceil((double) neededMaps / numTaskTrackers));
        maxReduceLoad = Math.min(localMaxReduceLoad, (int) Math
            .ceil((double) neededReduces / numTaskTrackers));
      }
      return new int[] { maxMapLoad, maxReduceLoad };
    }
docs: Determine the maximum number of maps or reduces that we are willing to run
  on a taskTracker which accept a maximum of localMaxMapLoad maps and
  localMaxReduceLoad reduces
  @param localMaxMapLoad The local maximum number of map tasks for a host
  @param localMaxReduceLoad The local maximum number of reduce tasks for a
  host
  @return An array of the two maximums: map then reduce.