Class CPUProcessScheduler

java.lang.Object
cambio.simulator.resources.cpu.scheduling.CPUProcessScheduler
Direct Known Subclasses:
FIFOScheduler, LIFOScheduler, MultiLevelFeedbackQueueScheduler, RoundRobinScheduler, ShortestJobNextScheduler

public abstract class CPUProcessScheduler extends Object
Superclass that provides the interface for all CPU scheduling strategies.
See Also:
  • 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:
    • retrieveNextProcess

      public abstract org.javatuples.Pair<CPUProcess,Integer> retrieveNextProcess()
      Pulls the next CPUProcess to handle and its assigned time/work quantum.
      Returns:
      a pair containing the next CPUProcess to handle and its assigned time/work quantum.
      See Also:
    • 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:
    • hasProcessesToSchedule

      public abstract boolean hasProcessesToSchedule()
      Checks whether this scheduler currently has processes ready to be retrieved from scheduling.
      Returns:
      true if there is a process ready to schedule, false otherwise
    • getTotalWorkDemand

      public abstract int getTotalWorkDemand()
      Calculates the sum of all scheduled process's demand remainders.
      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()
      Counts the amount of processes that are currently scheduled.
      Returns:
      the amount of processes that are currently scheduled.