Interface IQueueingStrategy
- All Known Implementing Classes:
MultipleQueuesStrategy,SingleQueueStrategy
public interface IQueueingStrategy
The queuing strategy of a process encapsulates the actual queue(s) of a set
of resource instances. Possible parameters are, for example, a single queue
for all instance versus a queue for each instance.
-
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 b) 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 p, IResourceInstance instance) 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)
-
Method Details
-
getNextProcessFor
Returns the next executable process for the given instance. -
addProcess
Adds a process to the queue(s).- Parameters:
inFront- If true, the process is added at the beginning of its queue, otherwise at its end.
-
activelyBalance
Depending on the underlying implementation the load is balanced between the resource instances.- Parameters:
instance- Instance initiating the load balance.
-
removePendingProcess
Removes at the pending queues of the queuing strategy and tries to remove the process there.- 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
- Parameters:
process- Process looked for.- Returns:
- True, if the process is in a pending queue of the strategy.
-
setRunningOn
Sets 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.- Parameters:
process- Process that shall be executed.instance- Target instance for the process.
-
runningOn
- 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.
-
removeRunning
Removes a process from the running list of the instance.- Parameters:
process- Process of interest.
-
isIdle
True, if the given resource has no running or pending jobs, otherwise false.- Parameters:
instance-
-
forkProcess
-
terminateProcess
-
fromRunningToWaiting
-
fromWaitingToReady
void fromWaitingToReady(IActiveProcess process, IResourceInstance current, boolean in_front_after_waiting) -
onSleep
-
registerProcess
-
getStarvingProcesses
-
resetStarvationInfo
void resetStarvationInfo() -
getQueueLengthFor
-