de.uka.ipd.sdq.scheduler.queueing
Interface IRunQueue

All Known Implementing Classes:
AbstractRunQueue, ActiveExpiredRunQueue, SingleRunQueue

public interface IRunQueue

Interface for process queues used by more general queuing strategies.

Author:
jens

Method Summary
 void 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.
 IRunQueue createNewInstance()
          Prototype Object Pattern.
 IProcessQueue getBestRunnableQueue(IResourceInstance instance)
           
 int getCurrentLoad()
          Returns the current number of processes in the ready queues.
 IActiveProcess getNextRunnableProcess()
          Returns the next runnable process.
 IActiveProcess getNextRunnableProcess(IResourceInstance instance)
          Returns the next process runnable on the given instance.
 List<IActiveProcess> getStarvingProcesses(double starvationLimit)
           
 double getWaitingTime(IActiveProcess process)
           
 List<IActiveProcess> 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 resetStarvationInfo()
           
 IResourceInstance 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 Detail

getCurrentLoad

int getCurrentLoad()
Returns the current number of processes in the ready queues.


getNextRunnableProcess

IActiveProcess getNextRunnableProcess(IResourceInstance instance)
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

boolean removeProcess(IActiveProcess process)
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

void addProcess(IActiveProcess process,
                boolean inFront)
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

IProcessQueue getBestRunnableQueue(IResourceInstance instance)
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

boolean contains(IActiveProcess process)
Parameters:
process - Process of interest.
Returns:
True, if the process is in this runqueue, otherwise false.

removePendingProcess

boolean removePendingProcess(IActiveProcess process)
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

boolean containsPending(IActiveProcess process)
Parameters:
process - Process of interest.
Returns:
True, if the process is pending in the runqueue.

removeRunning

void removeRunning(IActiveProcess process)
Removes a running process from the runqueue.

Parameters:
process - Process of interest.

containsRunning

boolean containsRunning(IActiveProcess process)
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

void setRunningOn(IActiveProcess process,
                  IResourceInstance instance)
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

IResourceInstance runningOn(IActiveProcess process)
Parameters:
process - Process of interest.
Returns:
The resource instance the given process is running on.

isIdle

boolean isIdle(IResourceInstance instance)
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

double getWaitingTime(IActiveProcess process)

setWaitingTime

void setWaitingTime(IActiveProcess process,
                    double waiting)

getStarvingProcesses

List<IActiveProcess> getStarvingProcesses(double starvationLimit)

resetStarvationInfo

void resetStarvationInfo()