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
delegateFields inherited from interface de.uka.ipd.sdq.simulation.abstractsimengine.IEntity
NULL -
Constructor Summary
ConstructorsConstructorDescriptionActiveProcess(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 TypeMethodDescriptionvoidaddStateSensor(de.uka.ipd.sdq.scheduler.sensors.IProcessStateSensor sensor) voidCancels an already scheduled ProceedEvent, e.g.booleancheckAffinity(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) booleandoublegetId()getName()de.uka.ipd.sdq.scheduler.ISchedulableProcessde.uka.ipd.sdq.scheduler.processes.PROCESS_STATEgetState()doublebooleaninthashCode()booleanbooleanbooleanisIdealInstance(IResourceInstance instance) Checks if the given instance is the ideal instance of the process.booleanisLastInstance(IResourceInstance instance) booleanisMovable(IResourceInstance targetInstance) booleanisReady()booleanbooleanprotected voidpassTimeProcessing(double passedTime) voidremoveNonAffineInstances(List<IResourceInstance> instances) Removes all instances the process is not allowed to run on from the given list.voidremoveStateSensor(de.uka.ipd.sdq.scheduler.sensors.IProcessStateSensor sensor) voidscheduleProceedEvent(IScheduler scheduler) Schedules a proceed event for the process at the time the current demand is expired.voidsetAffineInstances(List<IResourceInstance> instanceList) Sets the affine instances for the process.voidsetCurrentDemand(double currentDemand) Sets the new demand for a process.voidsetDelayedAction(IDelayedAction action) Sets a delayed action for the process, that need to be executed as soon as the process is running.voidsetIdealInstance(IResourceInstance instance) Sets the ideal instance of the process.voidsetLastInstance(IResourceInstance instance) Sets the instance the process is or just was running on.voidsetReady()Change the current state of the process to ready.voidChange the current state of the process to running.voidsetRunQueue(IRunQueue runqueue) Sets the current runqueue of the process.voidsetState(de.uka.ipd.sdq.scheduler.processes.PROCESS_STATE new_state) voidChange the current state of the process to waiting.voidtoNow()Proceeds all timing variables to the current simulation time.toString()voidupdate()Updates the process's timeslice and priority, if there is such.voidwasMovedTo(IResourceInstance dest) Methods inherited from class de.uka.ipd.sdq.scheduler.entities.SchedulerEntity
getModelMethods inherited from class de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimEntityDelegator
getEncapsulatedEntity, isScheduled, rescheduleMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:IActiveProcessUpdates the process's timeslice and priority, if there is such.- Specified by:
updatein interfaceIActiveProcess
-
getRunQueue
- Specified by:
getRunQueuein interfaceIActiveProcess- Returns:
- Returns the current runqueue of the process. NULL if the process is in no runqueue.
-
setRunQueue
Description copied from interface:IActiveProcessSets the current runqueue of the process.- Specified by:
setRunQueuein interfaceIActiveProcess
-
getSchedulableProcess
public de.uka.ipd.sdq.scheduler.ISchedulableProcess getSchedulableProcess()- Specified by:
getSchedulableProcessin interfacede.uka.ipd.sdq.scheduler.IRunningProcess
-
getName
- Specified by:
getNamein interfacede.uka.ipd.sdq.scheduler.IRunningProcess- Overrides:
getNamein classde.uka.ipd.sdq.simulation.abstractsimengine.SimulationElement
-
getId
- Specified by:
getIdin 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:
getStatein 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:IActiveProcessChange the current state of the process to running.- Specified by:
setRunningin interfaceIActiveProcess
-
setReady
public void setReady()Description copied from interface:IActiveProcessChange the current state of the process to ready.- Specified by:
setReadyin interfaceIActiveProcess
-
setWaiting
public void setWaiting()Description copied from interface:IActiveProcessChange the current state of the process to waiting.- Specified by:
setWaitingin interfaceIActiveProcess
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceIActiveProcess- Returns:
- True, if the process is in the running state, otherwise false.
-
isReady
public boolean isReady()- Specified by:
isReadyin interfaceIActiveProcess- Returns:
- True, if the process is in the ready state, otherwise false.
-
isWaiting
public boolean isWaiting()- Specified by:
isWaitingin 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:
addStateSensorin interfacede.uka.ipd.sdq.scheduler.IRunningProcess
-
removeStateSensor
public void removeStateSensor(de.uka.ipd.sdq.scheduler.sensors.IProcessStateSensor sensor) - Specified by:
removeStateSensorin interfacede.uka.ipd.sdq.scheduler.IRunningProcess
-
getCurrentDemand
public double getCurrentDemand()- Specified by:
getCurrentDemandin interfaceIActiveProcess- Returns:
- Returns the current demand of the process.
-
setCurrentDemand
public void setCurrentDemand(double currentDemand) Description copied from interface:IActiveProcessSets 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:
setCurrentDemandin interfaceIActiveProcess
-
toNow
public void toNow()Description copied from interface:IActiveProcessProceeds all timing variables to the current simulation time. The current demand is reduced only, if the process is in running state.- Specified by:
toNowin interfaceIActiveProcess
-
passTimeProcessing
protected void passTimeProcessing(double passedTime) -
setAffineInstances
Description copied from interface:IActiveProcessSets 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:
setAffineInstancesin interfaceIActiveProcess
-
hasAffinityList
public boolean hasAffinityList()- Specified by:
hasAffinityListin interfaceIActiveProcess- Returns:
- True, if the process has a list of affinity instances, otherwise false.
-
checkAffinity
Description copied from interface:IActiveProcessChecks if the given instance is in the set of affinity instances of the process.- Specified by:
checkAffinityin interfaceIActiveProcess- Returns:
-
removeNonAffineInstances
Description copied from interface:IActiveProcessRemoves all instances the process is not allowed to run on from the given list.- Specified by:
removeNonAffineInstancesin interfaceIActiveProcess
-
setIdealInstance
Description copied from interface:IActiveProcessSets the ideal instance of the process. That is the instance most preferred for the process.- Specified by:
setIdealInstancein interfaceIActiveProcess
-
hasIdealInstance
public boolean hasIdealInstance()- Specified by:
hasIdealInstancein interfaceIActiveProcess- Returns:
- True, if the process has an ideal instance, otherwise false.
-
isIdealInstance
Description copied from interface:IActiveProcessChecks if the given instance is the ideal instance of the process.- Specified by:
isIdealInstancein interfaceIActiveProcess- Returns:
- True, if the instance is the process' ideal instance, otherwise false.
-
getIdealInstance
- Specified by:
getIdealInstancein interfaceIActiveProcess- Returns:
- Returns the ideal instance of the process.
-
setLastInstance
Description copied from interface:IActiveProcessSets the instance the process is or just was running on.- Specified by:
setLastInstancein interfaceIActiveProcess
-
hasLastInstance
public boolean hasLastInstance()- Specified by:
hasLastInstancein interfaceIActiveProcess- Returns:
- True, if the last instance of the process is set.
-
getLastInstance
- Specified by:
getLastInstancein 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:
isLastInstancein interfaceIActiveProcess- Returns:
- True, if the given instance is equal to the last instance of the process.
-
isMovable
- Specified by:
isMovablein interfaceIActiveProcess
-
wasMovedTo
- Specified by:
wasMovedToin interfaceIActiveProcess
-
scheduleProceedEvent
Description copied from interface:IActiveProcessSchedules a proceed event for the process at the time the current demand is expired.- Specified by:
scheduleProceedEventin interfaceIActiveProcess
-
cancelProceedEvent
public void cancelProceedEvent()Description copied from interface:IActiveProcessCancels an already scheduled ProceedEvent, e.g. if the process is interrupted.- Specified by:
cancelProceedEventin interfaceIActiveProcess
-
getTimeUntilNextInterruption
public double getTimeUntilNextInterruption()- Specified by:
getTimeUntilNextInterruptionin interfaceIActiveProcess- Returns:
- Returns the time the process will be interrupted next.
-
setDelayedAction
Description copied from interface:IActiveProcessSets 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:
setDelayedActionin interfaceIActiveProcess
-
createNewInstance
public IActiveProcess createNewInstance(de.uka.ipd.sdq.scheduler.SchedulerModel model, de.uka.ipd.sdq.scheduler.ISchedulableProcess process) -
createNewInstance
- Specified by:
createNewInstancein interfaceIActiveProcess
-