Class ActiveProcess
java.lang.Object
de.uka.ipd.sdq.simulation.abstractsimengine.SimulationElement
de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimEntityDelegator
de.uka.ipd.sdq.scheduler.entities.SchedulerEntity
edu.kit.ipd.sdq.pcm.simulation.scheduler.exact.processes.impl.ActiveProcess
- All Implemented Interfaces:
de.uka.ipd.sdq.scheduler.IRunningProcess
,de.uka.ipd.sdq.simulation.abstractsimengine.IEntity
,IActiveProcess
- Direct Known Subclasses:
PreemptiveProcess
public class ActiveProcess
extends de.uka.ipd.sdq.scheduler.entities.SchedulerEntity
implements IActiveProcess
-
Field Summary
Fields inherited from class de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimEntityDelegator
delegate
Fields inherited from interface de.uka.ipd.sdq.simulation.abstractsimengine.IEntity
NULL
-
Constructor Summary
ConstructorDescriptionActiveProcess
(de.uka.ipd.sdq.scheduler.SchedulerModel model, de.uka.ipd.sdq.scheduler.ISchedulableProcess process) Creates a new wrapper containing the running information of a process. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addStateSensor
(de.uka.ipd.sdq.scheduler.sensors.IProcessStateSensor sensor) void
Cancels an already scheduled ProceedEvent, e.g.boolean
checkAffinity
(IResourceInstance instance) Checks if the given instance is in the set of affinity instances of the process.createNewInstance
(de.uka.ipd.sdq.scheduler.ISchedulableProcess process) createNewInstance
(de.uka.ipd.sdq.scheduler.SchedulerModel model, de.uka.ipd.sdq.scheduler.ISchedulableProcess process) boolean
double
getId()
getName()
de.uka.ipd.sdq.scheduler.ISchedulableProcess
de.uka.ipd.sdq.scheduler.processes.PROCESS_STATE
getState()
double
boolean
int
hashCode()
boolean
boolean
boolean
isIdealInstance
(IResourceInstance instance) Checks if the given instance is the ideal instance of the process.boolean
isLastInstance
(IResourceInstance instance) boolean
isMovable
(IResourceInstance targetInstance) boolean
isReady()
boolean
boolean
protected void
passTimeProcessing
(double passedTime) void
removeNonAffineInstances
(List<IResourceInstance> instances) Removes all instances the process is not allowed to run on from the given list.void
removeStateSensor
(de.uka.ipd.sdq.scheduler.sensors.IProcessStateSensor sensor) void
scheduleProceedEvent
(IScheduler scheduler) Schedules a proceed event for the process at the time the current demand is expired.void
setAffineInstances
(List<IResourceInstance> instanceList) Sets the affine instances for the process.void
setCurrentDemand
(double currentDemand) Sets the new demand for a process.void
setDelayedAction
(IDelayedAction action) Sets a delayed action for the process, that need to be executed as soon as the process is running.void
setIdealInstance
(IResourceInstance instance) Sets the ideal instance of the process.void
setLastInstance
(IResourceInstance instance) Sets the instance the process is or just was running on.void
setReady()
Change the current state of the process to ready.void
Change the current state of the process to running.void
setRunQueue
(IRunQueue runqueue) Sets the current runqueue of the process.void
setState
(de.uka.ipd.sdq.scheduler.processes.PROCESS_STATE new_state) void
Change the current state of the process to waiting.void
toNow()
Proceeds all timing variables to the current simulation time.toString()
void
update()
Updates the process's timeslice and priority, if there is such.void
wasMovedTo
(IResourceInstance dest) Methods inherited from class de.uka.ipd.sdq.scheduler.entities.SchedulerEntity
getModel
Methods inherited from class de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimEntityDelegator
getEncapsulatedEntity, isScheduled, reschedule
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface de.uka.ipd.sdq.simulation.abstractsimengine.IEntity
isScheduled, reschedule
-
Constructor Details
-
ActiveProcess
public ActiveProcess(de.uka.ipd.sdq.scheduler.SchedulerModel model, de.uka.ipd.sdq.scheduler.ISchedulableProcess process) Creates a new wrapper containing the running information of a process.- Parameters:
process
- The process that should be executed.id
- A unique identifier of the process.
-
-
Method Details
-
update
public void update()Description copied from interface:IActiveProcess
Updates the process's timeslice and priority, if there is such.- Specified by:
update
in interfaceIActiveProcess
-
getRunQueue
- Specified by:
getRunQueue
in interfaceIActiveProcess
- Returns:
- Returns the current runqueue of the process. NULL if the process is in no runqueue.
-
setRunQueue
Description copied from interface:IActiveProcess
Sets the current runqueue of the process.- Specified by:
setRunQueue
in interfaceIActiveProcess
-
getSchedulableProcess
public de.uka.ipd.sdq.scheduler.ISchedulableProcess getSchedulableProcess()- Specified by:
getSchedulableProcess
in interfacede.uka.ipd.sdq.scheduler.IRunningProcess
-
getName
- Specified by:
getName
in interfacede.uka.ipd.sdq.scheduler.IRunningProcess
- Overrides:
getName
in classde.uka.ipd.sdq.simulation.abstractsimengine.SimulationElement
-
getId
- Specified by:
getId
in interfacede.uka.ipd.sdq.scheduler.IRunningProcess
-
toString
-
equals
-
hashCode
public int hashCode() -
getState
public de.uka.ipd.sdq.scheduler.processes.PROCESS_STATE getState()- Specified by:
getState
in interfaceIActiveProcess
- Returns:
- Returns the current state of the process.
-
setState
public void setState(de.uka.ipd.sdq.scheduler.processes.PROCESS_STATE new_state) -
setRunning
public void setRunning()Description copied from interface:IActiveProcess
Change the current state of the process to running.- Specified by:
setRunning
in interfaceIActiveProcess
-
setReady
public void setReady()Description copied from interface:IActiveProcess
Change the current state of the process to ready.- Specified by:
setReady
in interfaceIActiveProcess
-
setWaiting
public void setWaiting()Description copied from interface:IActiveProcess
Change the current state of the process to waiting.- Specified by:
setWaiting
in interfaceIActiveProcess
-
isRunning
public boolean isRunning()- Specified by:
isRunning
in interfaceIActiveProcess
- Returns:
- True, if the process is in the running state, otherwise false.
-
isReady
public boolean isReady()- Specified by:
isReady
in interfaceIActiveProcess
- Returns:
- True, if the process is in the ready state, otherwise false.
-
isWaiting
public boolean isWaiting()- Specified by:
isWaiting
in interfaceIActiveProcess
- Returns:
- True, if the process is in the waiting state, otherwise false.
-
addStateSensor
public void addStateSensor(de.uka.ipd.sdq.scheduler.sensors.IProcessStateSensor sensor) - Specified by:
addStateSensor
in interfacede.uka.ipd.sdq.scheduler.IRunningProcess
-
removeStateSensor
public void removeStateSensor(de.uka.ipd.sdq.scheduler.sensors.IProcessStateSensor sensor) - Specified by:
removeStateSensor
in interfacede.uka.ipd.sdq.scheduler.IRunningProcess
-
getCurrentDemand
public double getCurrentDemand()- Specified by:
getCurrentDemand
in interfaceIActiveProcess
- Returns:
- Returns the current demand of the process.
-
setCurrentDemand
public void setCurrentDemand(double currentDemand) Description copied from interface:IActiveProcess
Sets the new demand for a process. In order to do so, the current demand must be zero, i.e. has been completely processed.- Specified by:
setCurrentDemand
in interfaceIActiveProcess
-
toNow
public void toNow()Description copied from interface:IActiveProcess
Proceeds all timing variables to the current simulation time. The current demand is reduced only, if the process is in running state.- Specified by:
toNow
in interfaceIActiveProcess
-
passTimeProcessing
protected void passTimeProcessing(double passedTime) -
setAffineInstances
Description copied from interface:IActiveProcess
Sets the affine instances for the process. The process is only allowed to run on these instances. If the list is set to NULL the process can run on any instance.- Specified by:
setAffineInstances
in interfaceIActiveProcess
-
hasAffinityList
public boolean hasAffinityList()- Specified by:
hasAffinityList
in interfaceIActiveProcess
- Returns:
- True, if the process has a list of affinity instances, otherwise false.
-
checkAffinity
Description copied from interface:IActiveProcess
Checks if the given instance is in the set of affinity instances of the process.- Specified by:
checkAffinity
in interfaceIActiveProcess
- Returns:
-
removeNonAffineInstances
Description copied from interface:IActiveProcess
Removes all instances the process is not allowed to run on from the given list.- Specified by:
removeNonAffineInstances
in interfaceIActiveProcess
-
setIdealInstance
Description copied from interface:IActiveProcess
Sets the ideal instance of the process. That is the instance most preferred for the process.- Specified by:
setIdealInstance
in interfaceIActiveProcess
-
hasIdealInstance
public boolean hasIdealInstance()- Specified by:
hasIdealInstance
in interfaceIActiveProcess
- Returns:
- True, if the process has an ideal instance, otherwise false.
-
isIdealInstance
Description copied from interface:IActiveProcess
Checks if the given instance is the ideal instance of the process.- Specified by:
isIdealInstance
in interfaceIActiveProcess
- Returns:
- True, if the instance is the process' ideal instance, otherwise false.
-
getIdealInstance
- Specified by:
getIdealInstance
in interfaceIActiveProcess
- Returns:
- Returns the ideal instance of the process.
-
setLastInstance
Description copied from interface:IActiveProcess
Sets the instance the process is or just was running on.- Specified by:
setLastInstance
in interfaceIActiveProcess
-
hasLastInstance
public boolean hasLastInstance()- Specified by:
hasLastInstance
in interfaceIActiveProcess
- Returns:
- True, if the last instance of the process is set.
-
getLastInstance
- Specified by:
getLastInstance
in interfaceIActiveProcess
- Returns:
- If the process is in running state, the method returns the instance the process is currently running on. Otherwise, the instance the process was recently running on is returned.
-
isLastInstance
- Specified by:
isLastInstance
in interfaceIActiveProcess
- Returns:
- True, if the given instance is equal to the last instance of the process.
-
isMovable
- Specified by:
isMovable
in interfaceIActiveProcess
-
wasMovedTo
- Specified by:
wasMovedTo
in interfaceIActiveProcess
-
scheduleProceedEvent
Description copied from interface:IActiveProcess
Schedules a proceed event for the process at the time the current demand is expired.- Specified by:
scheduleProceedEvent
in interfaceIActiveProcess
-
cancelProceedEvent
public void cancelProceedEvent()Description copied from interface:IActiveProcess
Cancels an already scheduled ProceedEvent, e.g. if the process is interrupted.- Specified by:
cancelProceedEvent
in interfaceIActiveProcess
-
getTimeUntilNextInterruption
public double getTimeUntilNextInterruption()- Specified by:
getTimeUntilNextInterruption
in interfaceIActiveProcess
- Returns:
- Returns the time the process will be interrupted next.
-
setDelayedAction
Description copied from interface:IActiveProcess
Sets a delayed action for the process, that need to be executed as soon as the process is running. Only one delayed action at a time is allowed.- Specified by:
setDelayedAction
in interfaceIActiveProcess
-
createNewInstance
public IActiveProcess createNewInstance(de.uka.ipd.sdq.scheduler.SchedulerModel model, de.uka.ipd.sdq.scheduler.ISchedulableProcess process) -
createNewInstance
- Specified by:
createNewInstance
in interfaceIActiveProcess
-