Class 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 Detail

      • 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 Detail

      • 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.
      • 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
      • 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.
      • 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.
      • 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.
      • 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)