Interface IQueueingStrategy
-
- All Known Implementing Classes:
MultipleQueuesStrategy,SingleQueueStrategy
public interface IQueueingStrategyThe 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidactivelyBalance(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)IActiveProcessgetNextProcessFor(IResourceInstance instance)Returns the next executable process for the given instance.intgetQueueLengthFor(SimResourceInstance simResourceInstance)List<IActiveProcess>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.voidresetStarvationInfo()IResourceInstancerunningOn(IActiveProcess process)voidsetRunningOn(IActiveProcess process, IResourceInstance instance)Sets the process as executing on the given instance.voidterminateProcess(IActiveProcess process)
-
-
-
Method Detail
-
getNextProcessFor
IActiveProcess getNextProcessFor(IResourceInstance instance)
Returns the next executable process for the given instance.
-
addProcess
void addProcess(IActiveProcess process, IResourceInstance current, boolean inFront)
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
void activelyBalance(IResourceInstance instance)
Depending on the underlying implementation the load is balanced between the resource instances.- Parameters:
instance- Instance initiating the load balance.
-
removePendingProcess
boolean removePendingProcess(IActiveProcess process)
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
boolean containsPending(IActiveProcess process)
- Parameters:
process- Process looked for.- Returns:
- True, if the process is in a pending queue of the strategy.
-
setRunningOn
void setRunningOn(IActiveProcess process, IResourceInstance instance)
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
IResourceInstance runningOn(IActiveProcess process)
- 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
void removeRunning(IActiveProcess process)
Removes a process from the running list of the instance.- Parameters:
process- Process of interest.
-
isIdle
boolean isIdle(IResourceInstance instance)
True, if the given resource has no running or pending jobs, otherwise false.- Parameters:
instance-
-
forkProcess
void forkProcess(IActiveProcess process, IResourceInstance current, boolean b)
-
terminateProcess
void terminateProcess(IActiveProcess process)
-
fromRunningToWaiting
void fromRunningToWaiting(IActiveProcess process)
-
fromWaitingToReady
void fromWaitingToReady(IActiveProcess process, IResourceInstance current, boolean in_front_after_waiting)
-
onSleep
void onSleep(IResourceInstance lastInstance)
-
registerProcess
void registerProcess(IActiveProcess p, IResourceInstance instance)
-
getStarvingProcesses
List<IActiveProcess> getStarvingProcesses(IResourceInstance instance, double starvationLimit)
-
resetStarvationInfo
void resetStarvationInfo()
-
getQueueLengthFor
int getQueueLengthFor(SimResourceInstance simResourceInstance)
-
-