Interface IRunQueue
- All Known Implementing Classes:
AbstractRunQueue
,ActiveExpiredRunQueue
,SingleRunQueue
public interface IRunQueue
Interface for process queues used by more general queuing strategies.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addProcess
(IActiveProcess process, boolean inFront) Adds a process to the runqueue.boolean
contains
(IActiveProcess process) boolean
containsPending
(IActiveProcess process) boolean
containsRunning
(IActiveProcess process) Checks if the runqueue contains a running process.Prototype Object Pattern.getBestRunnableQueue
(IResourceInstance instance) int
Returns the current number of processes in the ready queues.Returns the next runnable process.getNextRunnableProcess
(IResourceInstance instance) Returns the next process runnable on the given instance.getStarvingProcesses
(double starvationLimit) double
getWaitingTime
(IActiveProcess process) identifyMovableProcesses
(IResourceInstance targetInstance, boolean prio_increasing, boolean queue_ascending, int processes_needed) Composes a list of processes movable to the specified target.boolean
isEmpty()
boolean
isIdle
(IResourceInstance instance) True, if there is no process running on the given resource.boolean
processStarving
(double threshold) boolean
removePendingProcess
(IActiveProcess process) Removes a process from the pending queue of the runqueue, i.e.boolean
removeProcess
(IActiveProcess process) Removes a process from the runqueue.void
removeRunning
(IActiveProcess process) Removes a running process from the runqueue.void
runningOn
(IActiveProcess process) void
setRunningOn
(IActiveProcess process, IResourceInstance instance) Sets the given process as running on the specified instance.void
setWaitingTime
(IActiveProcess process, double waiting)
-
Method Details
-
getCurrentLoad
int getCurrentLoad()Returns the current number of processes in the ready queues. -
getNextRunnableProcess
Returns the next process runnable on the given instance. -
getNextRunnableProcess
IActiveProcess getNextRunnableProcess()Returns the next runnable process.- Returns:
-
isEmpty
boolean isEmpty()- Returns:
- True, if there are no processes in the runqueue.
-
removeProcess
Removes a process from the runqueue.- Parameters:
process
-- Returns:
- True, if the process was removed. False, if the process was not found in the queue.
-
addProcess
Adds a process to the runqueue.- Parameters:
inFront
- If true, the process is added at the beginning of its queue, otherwise it is added at the queue's end.
-
createNewInstance
IRunQueue createNewInstance()Prototype Object Pattern. Creates a new instance of the given runqueue.- Returns:
-
getBestRunnableQueue
- Parameters:
instance
- Resource instance a process is needed for.- Returns:
- Returns the most urgent queue which contains at least one process which can run on the given instance. NULL if no such queue exists.
-
identifyMovableProcesses
List<IActiveProcess> identifyMovableProcesses(IResourceInstance targetInstance, boolean prio_increasing, boolean queue_ascending, int processes_needed) Composes a list of processes movable to the specified target. The list is ordered in terms of what suits best for the target resource instance. The first element is better than the second which is better than the third and so on. Note that currently running processes are never added to the movable list.- Parameters:
targetInstance
- Resource instance the processes shall be moved to.prio_increasing
- If true, the processes in the resulting list are ordered with an increasing priority, otherwise with a decreasing priority.queue_ascending
- If true, processes in the resulting list are in the same order as in the queue, otherwise they are in reverse order.processes_needed
- The maximum number of processes needed for the resource.- Returns:
- An ordered list of processes movable to the target resource.
-
contains
- Parameters:
process
- Process of interest.- Returns:
- True, if the process is in this runqueue, otherwise false.
-
removePendingProcess
Removes a process from the pending queue of the runqueue, i.e. the process is in ready state.- Parameters:
process
- Process of interest.- Returns:
- True, if the process was successfully removed, otherwise (if the process was not found) false.
-
containsPending
- Parameters:
process
- Process of interest.- Returns:
- True, if the process is pending in the runqueue.
-
removeRunning
Removes a running process from the runqueue.- Parameters:
process
- Process of interest.
-
containsRunning
Checks if the runqueue contains a running process.- Parameters:
process
- Process of interest.- Returns:
- True, if the process is in the running list of the runqueue, otherwise false.
-
setRunningOn
Sets the given process as running on the specified instance. Note that the process must not be marked as running on another instance.- Parameters:
process
- Process to run.instance
- Instance the process shall run on.
-
runningOn
- Parameters:
process
- Process of interest.- Returns:
- The resource instance the given process is running on.
-
isIdle
True, if there is no process running on the given resource. Furthermore, the pending queue has to be empty if there is only one instance.- Parameters:
instance
-- Returns:
-
processStarving
boolean processStarving(double threshold) -
getWaitingTime
-
setWaitingTime
-
getStarvingProcesses
-
resetStarvationInfo
void resetStarvationInfo()
-