Class CPUProcessScheduler

java.lang.Object
de.rss.fachstudie.MiSim.resources.cpu.scheduling.CPUProcessScheduler
Direct Known Subclasses:
FIFOScheduler, LIFOScheduler, MLFQScheduler, RoundRobinScheduler, SPNScheduler

public abstract class CPUProcessScheduler
extends Object
Superclass that provides the interface for all CPU scheduling strategies.
See Also:
CPUProcess
  • Field Details

  • Constructor Details

    • CPUProcessScheduler

      public CPUProcessScheduler​(String name)
  • Method Details

    • enterProcess

      public abstract void enterProcess​(CPUProcess process)
      Enters the process into the scheduling queue.
      Parameters:
      process - CPUProcess that is to be scheduled
      See Also:
      CPUProcess
    • retrieveNextProcess

      public abstract org.javatuples.Pair<CPUProcess,​Integer> retrieveNextProcess()
      Pulls the next CPUProcess to handle and its assigned time/work quantum.

      For more complicated schedulers like a RoundRobinScheduler or MLFQScheduler this method does

      Returns:
      a pair containing the next CPUProcess to handle and its assigned time/work quantum.
      See Also:
      CPUProcess
    • retrieveNextProcessNoReschedule

      public abstract org.javatuples.Pair<CPUProcess,​Integer> retrieveNextProcessNoReschedule()
      Pulls the next CPUProcess to handle and its assigned time/work quantum.
      Prevents automatic rescheduling of the process like in round robin scheduling.

      This method is used to offer scheduling for multithreading. But requires manual rescheduling of unfinished processes.

      Returns:
      a pair containing the next CPUProcess to handle and its assigned time quantum.
      See Also:
      CPUProcess
    • hasThreadsToSchedule

      public abstract boolean hasThreadsToSchedule()
      Returns:
      true if there is a thread ready to schedule, false otherwise
    • getTotalWorkDemand

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

      public abstract void clear()
      Clears all current processes from the scheduler
    • size

      public abstract int size()