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
  • 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 interface IActiveProcess
    • getRunQueue

      public IRunQueue getRunQueue()
      Specified by:
      getRunQueue in interface IActiveProcess
      Returns:
      Returns the current runqueue of the process. NULL if the process is in no runqueue.
    • setRunQueue

      public void setRunQueue(IRunQueue runqueue)
      Description copied from interface: IActiveProcess
      Sets the current runqueue of the process.
      Specified by:
      setRunQueue in interface IActiveProcess
    • getSchedulableProcess

      public de.uka.ipd.sdq.scheduler.ISchedulableProcess getSchedulableProcess()
      Specified by:
      getSchedulableProcess in interface de.uka.ipd.sdq.scheduler.IRunningProcess
    • getName

      public String getName()
      Specified by:
      getName in interface de.uka.ipd.sdq.scheduler.IRunningProcess
      Overrides:
      getName in class de.uka.ipd.sdq.simulation.abstractsimengine.SimulationElement
    • getId

      public String getId()
      Specified by:
      getId in interface de.uka.ipd.sdq.scheduler.IRunningProcess
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getState

      public de.uka.ipd.sdq.scheduler.processes.PROCESS_STATE getState()
      Specified by:
      getState in interface IActiveProcess
      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 interface IActiveProcess
    • setReady

      public void setReady()
      Description copied from interface: IActiveProcess
      Change the current state of the process to ready.
      Specified by:
      setReady in interface IActiveProcess
    • setWaiting

      public void setWaiting()
      Description copied from interface: IActiveProcess
      Change the current state of the process to waiting.
      Specified by:
      setWaiting in interface IActiveProcess
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface IActiveProcess
      Returns:
      True, if the process is in the running state, otherwise false.
    • isReady

      public boolean isReady()
      Specified by:
      isReady in interface IActiveProcess
      Returns:
      True, if the process is in the ready state, otherwise false.
    • isWaiting

      public boolean isWaiting()
      Specified by:
      isWaiting in interface IActiveProcess
      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 interface de.uka.ipd.sdq.scheduler.IRunningProcess
    • removeStateSensor

      public void removeStateSensor(de.uka.ipd.sdq.scheduler.sensors.IProcessStateSensor sensor)
      Specified by:
      removeStateSensor in interface de.uka.ipd.sdq.scheduler.IRunningProcess
    • getCurrentDemand

      public double getCurrentDemand()
      Specified by:
      getCurrentDemand in interface IActiveProcess
      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 interface IActiveProcess
    • 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 interface IActiveProcess
    • passTimeProcessing

      protected void passTimeProcessing(double passedTime)
    • setAffineInstances

      public void setAffineInstances(List<IResourceInstance> instanceList)
      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 interface IActiveProcess
    • hasAffinityList

      public boolean hasAffinityList()
      Specified by:
      hasAffinityList in interface IActiveProcess
      Returns:
      True, if the process has a list of affinity instances, otherwise false.
    • checkAffinity

      public boolean checkAffinity(IResourceInstance instance)
      Description copied from interface: IActiveProcess
      Checks if the given instance is in the set of affinity instances of the process.
      Specified by:
      checkAffinity in interface IActiveProcess
      Returns:
    • removeNonAffineInstances

      public void removeNonAffineInstances(List<IResourceInstance> instances)
      Description copied from interface: IActiveProcess
      Removes all instances the process is not allowed to run on from the given list.
      Specified by:
      removeNonAffineInstances in interface IActiveProcess
    • setIdealInstance

      public void setIdealInstance(IResourceInstance instance)
      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 interface IActiveProcess
    • hasIdealInstance

      public boolean hasIdealInstance()
      Specified by:
      hasIdealInstance in interface IActiveProcess
      Returns:
      True, if the process has an ideal instance, otherwise false.
    • isIdealInstance

      public boolean isIdealInstance(IResourceInstance instance)
      Description copied from interface: IActiveProcess
      Checks if the given instance is the ideal instance of the process.
      Specified by:
      isIdealInstance in interface IActiveProcess
      Returns:
      True, if the instance is the process' ideal instance, otherwise false.
    • getIdealInstance

      public IResourceInstance getIdealInstance()
      Specified by:
      getIdealInstance in interface IActiveProcess
      Returns:
      Returns the ideal instance of the process.
    • setLastInstance

      public void setLastInstance(IResourceInstance instance)
      Description copied from interface: IActiveProcess
      Sets the instance the process is or just was running on.
      Specified by:
      setLastInstance in interface IActiveProcess
    • hasLastInstance

      public boolean hasLastInstance()
      Specified by:
      hasLastInstance in interface IActiveProcess
      Returns:
      True, if the last instance of the process is set.
    • getLastInstance

      public IResourceInstance getLastInstance()
      Specified by:
      getLastInstance in interface IActiveProcess
      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

      public boolean isLastInstance(IResourceInstance instance)
      Specified by:
      isLastInstance in interface IActiveProcess
      Returns:
      True, if the given instance is equal to the last instance of the process.
    • isMovable

      public boolean isMovable(IResourceInstance targetInstance)
      Specified by:
      isMovable in interface IActiveProcess
    • wasMovedTo

      public void wasMovedTo(IResourceInstance dest)
      Specified by:
      wasMovedTo in interface IActiveProcess
    • scheduleProceedEvent

      public void scheduleProceedEvent(IScheduler scheduler)
      Description copied from interface: IActiveProcess
      Schedules a proceed event for the process at the time the current demand is expired.
      Specified by:
      scheduleProceedEvent in interface IActiveProcess
    • 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 interface IActiveProcess
    • getTimeUntilNextInterruption

      public double getTimeUntilNextInterruption()
      Specified by:
      getTimeUntilNextInterruption in interface IActiveProcess
      Returns:
      Returns the time the process will be interrupted next.
    • setDelayedAction

      public void setDelayedAction(IDelayedAction action)
      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 interface IActiveProcess
    • createNewInstance

      public IActiveProcess createNewInstance(de.uka.ipd.sdq.scheduler.SchedulerModel model, de.uka.ipd.sdq.scheduler.ISchedulableProcess process)
    • createNewInstance

      public IActiveProcess createNewInstance(de.uka.ipd.sdq.scheduler.ISchedulableProcess process)
      Specified by:
      createNewInstance in interface IActiveProcess