Class FIFOScheduler
java.lang.Object
de.rss.fachstudie.MiSim.resources.cpu.scheduling.CPUProcessScheduler
de.rss.fachstudie.MiSim.resources.cpu.scheduling.FIFOScheduler
public class FIFOScheduler extends CPUProcessScheduler
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
-
Field Summary
Fields inherited from class de.rss.fachstudie.MiSim.resources.cpu.scheduling.CPUProcessScheduler
reporter -
Constructor Summary
Constructors Constructor Description FIFOScheduler(String name) -
Method Summary
Modifier and Type Method Description voidclear()Clears all current processes from the schedulervoidenterProcess(CPUProcess process)Enters the process into the scheduling queue.intgetTotalWorkDemand()booleanhasThreadsToSchedule()org.javatuples.Pair<CPUProcess,Integer>retrieveNextProcess()Pulls the next Process to handle and how much demand should be accomplished.org.javatuples.Pair<CPUProcess,Integer>retrieveNextProcessNoReschedule()Pulls the next Process to handle and its assigned time/work quantum.
Prevents automatic rescheduling of the process like in round robin scheduling.intsize()
-
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:
CPUProcess
-
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:
CPUProcess
-
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:
CPUProcess
-
hasThreadsToSchedule
public boolean hasThreadsToSchedule()- Specified by:
hasThreadsToSchedulein classCPUProcessScheduler- Returns:
- true if there is a thread ready to schedule, false otherwise
-
getTotalWorkDemand
public int getTotalWorkDemand()- 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()- Specified by:
sizein classCPUProcessScheduler
-