Class FIFOScheduler
java.lang.Object
cambio.simulator.resources.cpu.scheduling.CPUProcessScheduler
cambio.simulator.resources.cpu.scheduling.FIFOScheduler
First in first out scheduler.
Schedules all entered processes in the same order that they arrived in. Always assigns the full work demand needed for a processes.
- Author:
- Lion Wagner
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears all current processes from the scheduler.voidenterProcess(CPUProcess process) Enters the process into the scheduling queue.intCalculates the sum of all scheduled process's demand remainders.booleanChecks whether this scheduler currently has processes ready to be retrieved from scheduling.org.javatuples.Pair<CPUProcess,Integer> Pulls the next Process to handle and how much demand should be accomplished.org.javatuples.Pair<CPUProcess,Integer> Pulls the next Process to handle and its assigned time/work quantum.
Prevents automatic rescheduling of the process like in round-robin scheduling.intsize()Counts the amount of processes that are currently scheduled.
-
Constructor Details
-
FIFOScheduler
-
-
Method Details
-
enterProcess
Enters the process into the scheduling queue.- Specified by:
enterProcessin classCPUProcessScheduler- Parameters:
process- Process that is to be scheduled- See Also:
-
retrieveNextProcess
Pulls the next Process to handle and how much demand should be accomplished.- Specified by:
retrieveNextProcessin classCPUProcessScheduler- Returns:
- a pair containing the next process to handle and how much demand should be accomplished.
- See Also:
-
retrieveNextProcessNoReschedule
Pulls the next Process 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.
- Specified by:
retrieveNextProcessNoReschedulein classCPUProcessScheduler- Returns:
- a pair containing the next process to handle and its assigned time quantum.
- See Also:
-
hasProcessesToSchedule
public boolean hasProcessesToSchedule()Checks whether this scheduler currently has processes ready to be retrieved from scheduling.- Specified by:
hasProcessesToSchedulein classCPUProcessScheduler- Returns:
- true if there is a process ready to schedule, false otherwise
-
getTotalWorkDemand
public int getTotalWorkDemand()Calculates the sum of all scheduled process's demand remainders.- Specified by:
getTotalWorkDemandin classCPUProcessScheduler- 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:
clearin classCPUProcessScheduler
-
size
public int size()Counts the amount of processes that are currently scheduled.- Specified by:
sizein classCPUProcessScheduler- Returns:
- the amount of processes that are currently scheduled.
-