Class CPUProcessScheduler
java.lang.Object
cambio.simulator.resources.cpu.scheduling.CPUProcessScheduler
- Direct Known Subclasses:
FIFOScheduler,LIFOScheduler,MultiLevelFeedbackQueueScheduler,RoundRobinScheduler,ShortestJobNextScheduler
Superclass that provides the interface for all CPU scheduling strategies.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidclear()Clears all current processes from the scheduler.abstract voidenterProcess(CPUProcess process) Enters the process into the scheduling queue.abstract intCalculates the sum of all scheduled process's demand remainders.abstract booleanChecks whether this scheduler currently has processes ready to be retrieved from scheduling.abstract org.javatuples.Pair<CPUProcess,Integer> Pulls the nextCPUProcessto handle and its assigned time/work quantum.abstract org.javatuples.Pair<CPUProcess,Integer> Pulls the nextCPUProcessto handle and its assigned time/work quantum.
Prevents automatic rescheduling of the process like in round-robin scheduling.abstract intsize()Counts the amount of processes that are currently scheduled.
-
Constructor Details
-
CPUProcessScheduler
-
-
Method Details
-
enterProcess
Enters the process into the scheduling queue.- Parameters:
process-CPUProcessthat is to be scheduled- See Also:
-
retrieveNextProcess
Pulls the nextCPUProcessto handle and its assigned time/work quantum.- Returns:
- a pair containing the next
CPUProcessto handle and its assigned time/work quantum. - See Also:
-
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:
-
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.
-