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 Summary
Fields Modifier and Type Field Description protected MultiDataPointReporterreporterPredefined reporter. -
Constructor Summary
Constructors Constructor Description CPUProcessScheduler(String name) -
Method Summary
Modifier and Type Method Description abstract voidclear()Clears all current processes from the schedulerabstract voidenterProcess(CPUProcess process)Enters the process into the scheduling queue.abstract intgetTotalWorkDemand()abstract booleanhasThreadsToSchedule()abstract org.javatuples.Pair<CPUProcess,Integer>retrieveNextProcess()Pulls the nextCPUProcessto handle and its assigned time/work quantum.abstract org.javatuples.Pair<CPUProcess,Integer>retrieveNextProcessNoReschedule()Pulls the nextCPUProcessto handle and its assigned time/work quantum.
Prevents automatic rescheduling of the process like in round robin scheduling.abstract intsize()
-
Field Details
-
reporter
Predefined reporter.
-
-
Constructor Details
-
CPUProcessScheduler
-
-
Method Details
-
enterProcess
Enters the process into the scheduling queue.- Parameters:
process-CPUProcessthat is to be scheduled- See Also:
CPUProcess
-
retrieveNextProcess
Pulls the nextCPUProcessto handle and its assigned time/work quantum.For more complicated schedulers like a
RoundRobinSchedulerorMLFQSchedulerthis method does- Returns:
- a pair containing the next
CPUProcessto handle and its assigned time/work quantum. - See Also:
CPUProcess
-
retrieveNextProcessNoReschedule
Pulls the nextCPUProcessto 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
CPUProcessto 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()
-