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 TypeMethodDescriptionvoid
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) getNextProcessFor
(IResourceInstance instance) Returns the next executable process for the given instance.int
getQueueLengthFor
(SimResourceInstance simResourceInstance) 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
runningOn
(IActiveProcess process) void
setRunningOn
(IActiveProcess process, IResourceInstance instance) Sets the process as executing on the given instance.void
terminateProcess
(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
-