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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
activelyBalance(IResourceInstance instance)
Depending on the underlying implementation the load is balanced between the resource instances.void
addProcess(IActiveProcess process, IResourceInstance current, boolean inFront)
Adds a process to the queue(s).boolean
containsPending(IActiveProcess process)
void
forkProcess(IActiveProcess process, IResourceInstance current, boolean b)
void
fromRunningToWaiting(IActiveProcess process)
void
fromWaitingToReady(IActiveProcess process, IResourceInstance current, boolean in_front_after_waiting)
IActiveProcess
getNextProcessFor(IResourceInstance instance)
Returns the next executable process for the given instance.int
getQueueLengthFor(SimResourceInstance simResourceInstance)
List<IActiveProcess>
getStarvingProcesses(IResourceInstance instance, double starvationLimit)
boolean
isIdle(IResourceInstance instance)
True, if the given resource has no running or pending jobs, otherwise false.void
onSleep(IResourceInstance lastInstance)
void
registerProcess(IActiveProcess p, IResourceInstance instance)
boolean
removePendingProcess(IActiveProcess process)
Removes at the pending queues of the queuing strategy and tries to remove the process there.void
removeRunning(IActiveProcess process)
Removes a process from the running list of the instance.void
resetStarvationInfo()
IResourceInstance
runningOn(IActiveProcess process)
void
setRunningOn(IActiveProcess process, IResourceInstance instance)
Sets the process as executing on the given instance.void
terminateProcess(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)
-
-