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 void
clear()
Clears all current processes from the scheduler.abstract void
enterProcess
(CPUProcess process) Enters the process into the scheduling queue.abstract int
Calculates the sum of all scheduled process's demand remainders.abstract boolean
Checks whether this scheduler currently has processes ready to be retrieved from scheduling.abstract org.javatuples.Pair<CPUProcess,
Integer> Pulls the nextCPUProcess
to handle and its assigned time/work quantum.abstract org.javatuples.Pair<CPUProcess,
Integer> Pulls the nextCPUProcess
to handle and its assigned time/work quantum.
Prevents automatic rescheduling of the process like in round-robin scheduling.abstract int
size()
Counts the amount of processes that are currently scheduled.
-
Constructor Details
-
CPUProcessScheduler
-
-
Method Details
-
enterProcess
Enters the process into the scheduling queue.- Parameters:
process
-CPUProcess
that is to be scheduled- See Also:
-
retrieveNextProcess
Pulls the nextCPUProcess
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
Pulls the nextCPUProcess
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.
-