Module Simula

Class RTS_Process

All Implemented Interfaces:
Runnable
Direct Known Subclasses:
RTS_MAIN_PROGRAM

public class RTS_Process extends RTS_Link
System class Process.
 link class process;
      begin ref (EVENT_NOTICE) EVENT;
         Boolean TERMINATED;
         Boolean procedure idle;              idle := EVENT==none;
         Boolean procedure terminated;  terminated := TERMINATED;

         long real procedure evtime;
            if idle then  error("..." ! No Evtime for idle process)
            else evtime := EVENT.EVTIME;

         ref (process) procedure nextev;
            nextev :- if  idle or else EVENT.suc == none then none
                     else EVENT.suc.PROC;

         detach;
         inner;
         TERMINATED:= true;
         passivate;
         error("..." ! Terminated process;)
     end process;
 
An object of a class prefixed by "process" is called a process object. A process object has the properties of "link" and, in addition, the capability to be represented in the sequencing set and to be manipulated by certain sequencing statements which may modify its "process state". The possible process states are: active, suspended, passive and terminated.

When a process object is generated it immediately becomes detached and its reactivation point positioned in front of the first statement of its user- defined operation rule. The process object remains detached throughout its dynamic scope.

The procedure "idle" has the value true if the process object is not currently represented in the sequencing set. It is said to be in the passive or terminated state depending on the value of the procedure "terminated". An idle process object is passive if its reactivation point is at a user-defined prefix level. If and when the PSC passes through the final end of the user-defined part of the body, it proceeds to the final operations at the prefix level of the class "process", and the value of the procedure "terminated" becomes true. (Although the process state "terminated" is not strictly equivalent to the corresponding basic concept defined in chapter 7, an implementation may treat a terminated process object as terminated in the strict sense). A process object currently represented in the sequencing set is said to be "suspended", unless it is represented by the event notice at the lower end of the sequencing set. In the latter case it is active. A suspended process is scheduled to become active at the system time indicated by the attribute EVTIME of its event notice. This time value may be accessed through the procedure "evtime". The procedure "nextev" references the process object, if any, represented by the next event notice in the sequencing set.

Link to GitHub: Source File.

Author:
SIMULA Standards Group, Øystein Myhre Andersen
  • Field Details

  • Constructor Details

    • RTS_Process

      public RTS_Process(RTS_RTObject SL)
      Create a new _Process.
      Parameters:
      SL - staticLink
  • Method Details

    • isDetachUsed

      public boolean isDetachUsed()
      Description copied from class: RTS_RTObject
      This is a static property generated by the compiler.
      It will return true for Blocks in which 'detach' is used.
      This method is redefined in every subclass which represent a Simula Block.
      Overrides:
      isDetachUsed in class RTS_RTObject
      Returns:
      true: this object is a QPS System block
    • _STM

      public RTS_Process _STM()
      Description copied from class: RTS_RTObject
      Method representing the Statements in this Block
      This method is virtual and must be redefined in blocks.
      Overrides:
      _STM in class RTS_Link
      Returns:
      a pointer to this _RTObject
    • terminate

      protected void terminate()
      Utility: Terminate this Process.
    • idle

      public boolean idle()
      Returns true if this process is scheduled (in SQS)
      Returns:
      true if this process is scheduled, otherwise false
    • terminated

      public boolean terminated()
      Procedure terminated.
      Returns:
      true if this process is terminated
    • evtime

      public double evtime()
      Returns the event time.
      Returns:
      the event time
      Throws:
      RTS_SimulaRuntimeError - if this process is idle
    • nextev

      public RTS_Process nextev()
      Returns the next process in SQS.
      Returns:
      the next process in SQS
    • toString

      public String toString()
      Description copied from class: RTS_RTObject
      Returns a string representation of the object.
      Overrides:
      toString in class RTS_BASICIO