Class RoundRobinScheduler

java.lang.Object
de.rss.fachstudie.MiSim.resources.cpu.scheduling.CPUProcessScheduler
de.rss.fachstudie.MiSim.resources.cpu.scheduling.RoundRobinScheduler

public final class RoundRobinScheduler
extends CPUProcessScheduler
Self adjusting Round Robin (SARR) scheduler with dynamic median-based quantum calculation.

Algorithm developed by Ram Matarneh: Self-Adjustment Time Quantum in Round Robin Algorithm Depending on Burst Time of the Now Running Processes

Executes a round robin scheduling where the assigned work quantum is the median of all current left over work demands of all entered processes. The quantum is updated each time a new processes enters or all processes had a round with the current quantum. This provides a shorter average waiting and turn-around time than the fixed quantum round robin. Further, this round robin scheduler adjust dynamically to demand sizes that can heavily vary between experiments/architecture descriptions.

Keeps processes in order (first come first serve). And ensures fairness.

Author:
Lion Wagner
See Also:
SARR algorithm
  • Constructor Details

    • RoundRobinScheduler

      public RoundRobinScheduler​(String name)
  • Method Details

    • enterProcess

      public void enterProcess​(CPUProcess process)
      Enters the process into the scheduling queue.
      Specified by:
      enterProcess in class CPUProcessScheduler
      Parameters:
      process - Process that is to be scheduled
      See Also:
      CPUProcess
    • retrieveNextProcess

      public org.javatuples.Pair<CPUProcess,​Integer> retrieveNextProcess()
      Pulls the next Process to handle and its assigned time/work quantum.
      Specified by:
      retrieveNextProcess in class CPUProcessScheduler
      Returns:
      a pair containing the next process to handle and its assigned time/work quantum.
      See Also:
      CPUProcess
    • retrieveNextProcessNoReschedule

      public org.javatuples.Pair<CPUProcess,​Integer> retrieveNextProcessNoReschedule()
      Interface used by Multi Level Feedback queues.

      Does not put the process back into the Queue.

      Specified by:
      retrieveNextProcessNoReschedule in class CPUProcessScheduler
      Returns:
      a pair containing the next process to handle and its assigned time quantum.
      See Also:
      CPUProcess
    • hasThreadsToSchedule

      public boolean hasThreadsToSchedule()
      Specified by:
      hasThreadsToSchedule in class CPUProcessScheduler
      Returns:
      true if there is a thread ready to schedule, false otherwise
    • getTotalWorkDemand

      public int getTotalWorkDemand()
      Specified by:
      getTotalWorkDemand in class CPUProcessScheduler
      Returns:
      the sum of the demand remainder of all processes that are currently in queue.
    • clear

      public void clear()
      Clears all current processes from the scheduler
      Specified by:
      clear in class CPUProcessScheduler
    • size

      public int size()
      Specified by:
      size in class CPUProcessScheduler