Class SingleQueueStrategy
java.lang.Object
edu.kit.ipd.sdq.pcm.simulation.scheduler.exact.queueing.strategies.SingleQueueStrategy
- All Implemented Interfaces:
IQueueingStrategy
-
Constructor Summary
ConstructorsConstructorDescriptionSingleQueueStrategy(IRunQueue runQueue, IProcessSelector processSelector, IInstanceSelector idealInstanceSelector) -
Method Summary
Modifier and TypeMethodDescriptionvoidactivelyBalance(IResourceInstance instance) Depending on the underlying implementation the load is balanced between the resource instances.voidaddProcess(IActiveProcess process, IResourceInstance current, boolean inFront) Adds a process to the queue(s).booleancontainsPending(IActiveProcess process) voidforkProcess(IActiveProcess process, IResourceInstance current, boolean inFront) voidfromRunningToWaiting(IActiveProcess process) voidfromWaitingToReady(IActiveProcess process, IResourceInstance current, boolean in_front_after_waiting) getNextProcessFor(IResourceInstance instance) Returns the next executable process for the given instance.intgetQueueLengthFor(SimResourceInstance simResourceInstance) getStarvingProcesses(IResourceInstance instance, double starvationLimit) booleanisIdle(IResourceInstance instance) True, if the given resource has no running or pending jobs, otherwise false.voidonSleep(IResourceInstance lastInstance) voidregisterProcess(IActiveProcess process, IResourceInstance current) booleanremovePendingProcess(IActiveProcess process) Removes at the pending queues of the queuing strategy and tries to remove the process there.voidremoveRunning(IActiveProcess process) Removes a process from the running list of the instance.voidrunningOn(IActiveProcess process) voidsetRunningOn(IActiveProcess process, IResourceInstance instance) Sets the process as executing on the given instance.voidterminateProcess(IActiveProcess process)
-
Constructor Details
-
SingleQueueStrategy
public SingleQueueStrategy(IRunQueue runQueue, IProcessSelector processSelector, IInstanceSelector idealInstanceSelector)
-
-
Method Details
-
getNextProcessFor
Description copied from interface:IQueueingStrategyReturns the next executable process for the given instance.- Specified by:
getNextProcessForin interfaceIQueueingStrategy
-
registerProcess
- Specified by:
registerProcessin interfaceIQueueingStrategy
-
addProcess
Description copied from interface:IQueueingStrategyAdds a process to the queue(s).- Specified by:
addProcessin interfaceIQueueingStrategyinFront- If true, the process is added at the beginning of its queue, otherwise at its end.
-
activelyBalance
Description copied from interface:IQueueingStrategyDepending on the underlying implementation the load is balanced between the resource instances.- Specified by:
activelyBalancein interfaceIQueueingStrategy- Parameters:
instance- Instance initiating the load balance.
-
removePendingProcess
Description copied from interface:IQueueingStrategyRemoves at the pending queues of the queuing strategy and tries to remove the process there.- Specified by:
removePendingProcessin interfaceIQueueingStrategy- Parameters:
process- Process that should be removed.- Returns:
- True, if the process was successfully removed. False, if the process was not found in the pending queues.
-
containsPending
- Specified by:
containsPendingin interfaceIQueueingStrategy- Parameters:
process- Process looked for.- Returns:
- True, if the process is in a pending queue of the strategy.
-
removeRunning
Description copied from interface:IQueueingStrategyRemoves a process from the running list of the instance.- Specified by:
removeRunningin interfaceIQueueingStrategy- Parameters:
process- Process of interest.
-
runningOn
- Specified by:
runningOnin interfaceIQueueingStrategy- Parameters:
process- Process of interest.- Returns:
- Returns the resource instance the process is currently running on. NULL if the process is not assigned to a resource.
-
setRunningOn
Description copied from interface:IQueueingStrategySets the process as executing on the given instance. In order for this operation to be successful, the process must be in ready state and in the a pending queue of the strategy.- Specified by:
setRunningOnin interfaceIQueueingStrategy- Parameters:
process- Process that shall be executed.instance- Target instance for the process.
-
isIdle
Description copied from interface:IQueueingStrategyTrue, if the given resource has no running or pending jobs, otherwise false.- Specified by:
isIdlein interfaceIQueueingStrategy
-
forkProcess
- Specified by:
forkProcessin interfaceIQueueingStrategy
-
fromRunningToWaiting
- Specified by:
fromRunningToWaitingin interfaceIQueueingStrategy
-
fromWaitingToReady
public void fromWaitingToReady(IActiveProcess process, IResourceInstance current, boolean in_front_after_waiting) - Specified by:
fromWaitingToReadyin interfaceIQueueingStrategy
-
terminateProcess
- Specified by:
terminateProcessin interfaceIQueueingStrategy
-
onSleep
- Specified by:
onSleepin interfaceIQueueingStrategy
-
getStarvingProcesses
public List<IActiveProcess> getStarvingProcesses(IResourceInstance instance, double starvationLimit) - Specified by:
getStarvingProcessesin interfaceIQueueingStrategy
-
resetStarvationInfo
public void resetStarvationInfo()- Specified by:
resetStarvationInfoin interfaceIQueueingStrategy
-
getQueueLengthFor
- Specified by:
getQueueLengthForin interfaceIQueueingStrategy
-