Class PriorityArray
- java.lang.Object
-
- edu.kit.ipd.sdq.pcm.simulation.scheduler.exact.queueing.basicqueues.PriorityArray
-
- All Implemented Interfaces:
IProcessQueue
public class PriorityArray extends Object implements IProcessQueue
-
-
Constructor Summary
Constructors Constructor Description PriorityArray(de.uka.ipd.sdq.scheduler.SchedulerModel model, IPriorityManager priority_manager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(IActiveProcess process, boolean in_front)
void
addFirst(IActiveProcess process)
Adds a new process at the BEGINNING of the process' priority's queue.void
addLast(IActiveProcess process)
Adds a new process at the END of the process' priority's queue.Iterable<IActiveProcess>
ascending()
boolean
contains(IActiveProcess process)
IProcessQueue
createNewInstance()
Iterable<IActiveProcess>
descending()
IProcessQueue
getBestRunnableQueue(IResourceInstance instance)
Returns the queue with the highest priority of which at least one process can be executed on instance.IActiveProcess
getNextRunnableProcess()
IActiveProcess
getNextRunnableProcess(IResourceInstance instance)
Returns the process with the highest priority runnable on the given instance.List<IActiveProcess>
getStarvingProcesses(double starvationLimit)
double
getWaitingTime(IActiveProcess process)
void
identifyMovableProcesses(IResourceInstance target_instance, boolean prio_increasing, boolean queue_ascending, int processes_needed, List<IActiveProcess> process_list)
Adds processes that do not violate the affinity constraint to the list in the specified direction.boolean
isEmpty()
boolean
processStarving(double threshold)
boolean
remove(IActiveProcess process)
Removes the given process from the priorityarray.void
setWaitingTime(IActiveProcess process, double waiting)
int
size()
Returns the number of processes in the priority array.
-
-
-
Constructor Detail
-
PriorityArray
public PriorityArray(de.uka.ipd.sdq.scheduler.SchedulerModel model, IPriorityManager priority_manager)
-
-
Method Detail
-
size
public int size()
Returns the number of processes in the priority array.- Specified by:
size
in interfaceIProcessQueue
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceIProcessQueue
- Returns:
- True, if the priority array is empty. False, otherwise.
-
remove
public boolean remove(IActiveProcess process)
Removes the given process from the priorityarray.- Specified by:
remove
in interfaceIProcessQueue
- Parameters:
process
-- Returns:
- True, if the process has been successfully removed. False, otherwise.
-
addLast
public void addLast(IActiveProcess process)
Adds a new process at the END of the process' priority's queue.- Specified by:
addLast
in interfaceIProcessQueue
- Parameters:
process
-
-
addFirst
public void addFirst(IActiveProcess process)
Adds a new process at the BEGINNING of the process' priority's queue.- Specified by:
addFirst
in interfaceIProcessQueue
- Parameters:
process
-
-
add
public void add(IActiveProcess process, boolean in_front)
- Specified by:
add
in interfaceIProcessQueue
-
getBestRunnableQueue
public IProcessQueue getBestRunnableQueue(IResourceInstance instance)
Returns the queue with the highest priority of which at least one process can be executed on instance.- Specified by:
getBestRunnableQueue
in interfaceIProcessQueue
- Parameters:
instance
-- Returns:
-
getNextRunnableProcess
public IActiveProcess getNextRunnableProcess(IResourceInstance instance)
Returns the process with the highest priority runnable on the given instance.- Specified by:
getNextRunnableProcess
in interfaceIProcessQueue
- Parameters:
instance
-- Returns:
-
contains
public boolean contains(IActiveProcess process)
- Specified by:
contains
in interfaceIProcessQueue
-
getNextRunnableProcess
public IActiveProcess getNextRunnableProcess()
- Specified by:
getNextRunnableProcess
in interfaceIProcessQueue
-
identifyMovableProcesses
public void identifyMovableProcesses(IResourceInstance target_instance, boolean prio_increasing, boolean queue_ascending, int processes_needed, List<IActiveProcess> process_list)
Adds processes that do not violate the affinity constraint to the list in the specified direction.- Specified by:
identifyMovableProcesses
in interfaceIProcessQueue
- Parameters:
target_instance
-
-
ascending
public Iterable<IActiveProcess> ascending()
- Specified by:
ascending
in interfaceIProcessQueue
-
descending
public Iterable<IActiveProcess> descending()
- Specified by:
descending
in interfaceIProcessQueue
-
createNewInstance
public IProcessQueue createNewInstance()
- Specified by:
createNewInstance
in interfaceIProcessQueue
-
processStarving
public boolean processStarving(double threshold)
- Specified by:
processStarving
in interfaceIProcessQueue
-
getWaitingTime
public double getWaitingTime(IActiveProcess process)
- Specified by:
getWaitingTime
in interfaceIProcessQueue
-
setWaitingTime
public void setWaitingTime(IActiveProcess process, double waiting)
- Specified by:
setWaitingTime
in interfaceIProcessQueue
-
getStarvingProcesses
public List<IActiveProcess> getStarvingProcesses(double starvationLimit)
- Specified by:
getStarvingProcesses
in interfaceIProcessQueue
-
-