Class SingleRunQueue
- java.lang.Object
-
- edu.kit.ipd.sdq.pcm.simulation.scheduler.exact.queueing.runqueues.AbstractRunQueue
-
- edu.kit.ipd.sdq.pcm.simulation.scheduler.exact.queueing.runqueues.SingleRunQueue
-
- All Implemented Interfaces:
IRunQueue
public class SingleRunQueue extends AbstractRunQueue
-
-
Field Summary
-
Fields inherited from class edu.kit.ipd.sdq.pcm.simulation.scheduler.exact.queueing.runqueues.AbstractRunQueue
running_on_table
-
-
Constructor Summary
Constructors Constructor Description SingleRunQueue(IProcessQueue queue_prototype)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addProcessToRunQueue(IActiveProcess process, boolean inFront)
Template method.boolean
containsPending(IActiveProcess process)
Template Method.IRunQueue
createNewInstance()
Prototype Object Pattern.IProcessQueue
getBestRunnableQueue(IResourceInstance instance)
IActiveProcess
getNextRunnableProcess()
Returns the next runnable process.IActiveProcess
getNextRunnableProcess(IResourceInstance instance)
Returns the next process runnable on the given instance.List<IActiveProcess>
getStarvingProcesses(double starvationLimit)
double
getWaitingTime(IActiveProcess process)
List<IActiveProcess>
identifyMovableProcesses(IResourceInstance targetInstance, boolean prio_increasing, boolean queue_ascending, int processes_needed)
Composes a list of processes movable to the specified target.protected int
numWaitingProcesses()
Template Method.boolean
processStarving(double threshold)
boolean
removePendingProcess(IActiveProcess process)
Template method.void
resetStarvationInfo()
void
setWaitingTime(IActiveProcess process, double waiting)
-
Methods inherited from class edu.kit.ipd.sdq.pcm.simulation.scheduler.exact.queueing.runqueues.AbstractRunQueue
addProcess, contains, containsRunning, getCurrentLoad, isEmpty, isIdle, removeProcess, removeRunning, runningOn, setRunningOn
-
-
-
-
Constructor Detail
-
SingleRunQueue
public SingleRunQueue(IProcessQueue queue_prototype)
-
-
Method Detail
-
numWaitingProcesses
protected int numWaitingProcesses()
Description copied from class:AbstractRunQueue
Template Method. Returns the number of processs waiting in the queue.- Specified by:
numWaitingProcesses
in classAbstractRunQueue
- Returns:
-
getNextRunnableProcess
public IActiveProcess getNextRunnableProcess(IResourceInstance instance)
Description copied from interface:IRunQueue
Returns the next process runnable on the given instance.- Specified by:
getNextRunnableProcess
in interfaceIRunQueue
- Specified by:
getNextRunnableProcess
in classAbstractRunQueue
-
getNextRunnableProcess
public IActiveProcess getNextRunnableProcess()
Description copied from interface:IRunQueue
Returns the next runnable process.- Returns:
-
removePendingProcess
public boolean removePendingProcess(IActiveProcess process)
Description copied from class:AbstractRunQueue
Template method. Removes the given process from the queue.- Specified by:
removePendingProcess
in interfaceIRunQueue
- Specified by:
removePendingProcess
in classAbstractRunQueue
- Parameters:
process
- Process of interest.- Returns:
- True, if the process was successfully removed, otherwise (if the process was not found) false.
-
createNewInstance
public IRunQueue createNewInstance()
Description copied from interface:IRunQueue
Prototype Object Pattern. Creates a new instance of the given runqueue.- Returns:
-
identifyMovableProcesses
public List<IActiveProcess> identifyMovableProcesses(IResourceInstance targetInstance, boolean prio_increasing, boolean queue_ascending, int processes_needed)
Description copied from interface:IRunQueue
Composes a list of processes movable to the specified target. The list is ordered in terms of what suits best for the target resource instance. The first element is better than the second which is better than the third and so on. Note that currently running processes are never added to the movable list.- Parameters:
targetInstance
- Resource instance the processes shall be moved to.prio_increasing
- If true, the processes in the resulting list are ordered with an increasing priority, otherwise with a decreasing priority.queue_ascending
- If true, processes in the resulting list are in the same order as in the queue, otherwise they are in reverse order.processes_needed
- The maximum number of processes needed for the resource.- Returns:
- An ordered list of processes movable to the target resource.
-
getBestRunnableQueue
public IProcessQueue getBestRunnableQueue(IResourceInstance instance)
- Parameters:
instance
- Resource instance a process is needed for.- Returns:
- Returns the most urgent queue which contains at least one process which can run on the given instance. NULL if no such queue exists.
-
containsPending
public boolean containsPending(IActiveProcess process)
Description copied from class:AbstractRunQueue
Template Method. Returns- Specified by:
containsPending
in interfaceIRunQueue
- Specified by:
containsPending
in classAbstractRunQueue
- Parameters:
process
- Process of interest.- Returns:
- True, if the process is pending in the runqueue.
-
addProcessToRunQueue
protected void addProcessToRunQueue(IActiveProcess process, boolean inFront)
Description copied from class:AbstractRunQueue
Template method.- Specified by:
addProcessToRunQueue
in classAbstractRunQueue
-
processStarving
public boolean processStarving(double threshold)
-
setWaitingTime
public void setWaitingTime(IActiveProcess process, double waiting)
-
getWaitingTime
public double getWaitingTime(IActiveProcess process)
-
getStarvingProcesses
public List<IActiveProcess> getStarvingProcesses(double starvationLimit)
-
resetStarvationInfo
public void resetStarvationInfo()
-
-