Solving the Executer problem. E. Bracke SL/RFS-bc ---***--- 1 Table of contents. 2 Characteristics. . . . . . . . . . . . . . . . . . . . . 1 3 Meaning of abbreviations. . . . . . . . . . . . . . . . . 2 3.1 EXE_I. . . . . . . . . . . . . . . . . . . . . . . . 2 3.1.1 CMD_NT. . . . . . . . . . . . . . . . . . . . . 2 3.1.2 RCA_P. . . . . . . . . . . . . . . . . . . . . 2 3.1.3 EXE_N. . . . . . . . . . . . . . . . . . . . . 2 3.1.4 D_PTR. . . . . . . . . . . . . . . . . . . . . 2 3.2 CMD_I. . . . . . . . . . . . . . . . . . . . . . . . 2 3.2.1 D_PTR. . . . . . . . . . . . . . . . . . . . . 3 3.2.2 SEQ_I. . . . . . . . . . . . . . . . . . . . . 3 3.2.3 SC_P. . . . . . . . . . . . . . . . . . . . . . 3 3.2.4 RM_PTR. . . . . . . . . . . . . . . . . . . . . 3 3.3 RM_I. . . . . . . . . . . . . . . . . . . . . . . . 3 3.3.1 C_STA. . . . . . . . . . . . . . . . . . . . . 3 3.4 RR_I. . . . . . . . . . . . . . . . . . . . . . . . 4 3.4.1 RCA_P. . . . . . . . . . . . . . . . . . . . . 4 3.4.2 CLA_A. . . . . . . . . . . . . . . . . . . . . 4 3.4.3 CLA_R. . . . . . . . . . . . . . . . . . . . . 4 3.4.4 EXE_N. . . . . . . . . . . . . . . . . . . . . 4 3.4.5 RR_PTR. . . . . . . . . . . . . . . . . . . . . 4 3.5 CMD_Nn. . . . . . . . . . . . . . . . . . . . . . . 4 3.5.1 SAA_M. . . . . . . . . . . . . . . . . . . . . 5 3.5.2 SEQ. . . . . . . . . . . . . . . . . . . . . . 5 3.5.2.1 C_A. . . . . . . . . . . . . . . . . . . . 5 3.5.2.2 CMD. . . . . . . . . . . . . . . . . . . . 5 3.5.2.3 CLA_A. . . . . . . . . . . . . . . . . . . 5 4 Executer algorithm (simplified). . . . . . . . . . . . . 6 5 Executer Interfaces. . . . . . . . . . . . . . . . . . . 9 6 Executer storage. . . . . . . . . . . . . . . . . . . . . 11 7 Executer ORACLE flattable. . . . . . . . . . . . . . . . 12 8 Execution examples. . . . . . . . . . . . . . . . . . . . 14 2 Characteristics. - Decoupling of (RF application) commands from the PCA system. Minimal data passing to the application insures maximal decoupling of RF application code from the PCA system. - Linear sequence execution. A table, called a sequence, containing a number of commands is executed one command after the other. - Nested sequence execution. A command in a sequence can be another sequence. - "Test and skip part of a sequence" execution. A test command is immediately followed in the sequence by a data interpretation step. This step then can switch execution to any other step in the current sequence, rather than to the immediately following one that is normally selected. - "Start of sequence ." sequence start message. - "End of sequence ." sequence end message. A unique "End of sequence ." for master sequence end message is generated by distinguishing it in the "message code" field of the return message sent to Reply & Report. - "Abort of sequence ." sequence end message. - Means for presentation level selectable suppression of return messages. - Save (nested) sequence abort after "not succeeded" command execution (controlled panic). A "not succeeded" return message from a command in a sequence aborts the current (and all parent) sequence(s) by means of a sequence abort command. This command is responsible for termination of the current sequence in a safe, controlled manner. - Kernel controlled abort of the currently running (nested) sequence or of a (master) sequence not yet started (still in the Executer's pipe). - Access to sequence end from any command in case of obsolescence of the current sequence. Many commands must be tried first to see whether the rest of the sequence has to be executed as well. The decision to continue or not can thus be made by any CMD_n in a sequence. In fact this is a special case of the "test and skip part of a sequence" option. A special message (e.g. "Initialize CMD_n") in a data buffer could be sent to "E-class" CMD_n's allowing them to initialize their data bases and other specificities during run-time. In this phase, the executer executes a special sequence, comprising all E-class CMD_n's requiring such initialization. 3 Meaning of abbreviations. 3.1 EXE_I. EXEcuter Interface. The formal parameter list sent by the Kernel to the Executer process in its pipe. 3.1.1 CMD_NT. CoMmanD Name/Table. Contains a reference to either an ORACLE CoMmanD Name (flat)table or a Kernel generated CoMmanD Table in the ORACLE (flat)table format. 3.1.2 RCA_P. Remote Command Array entry Pointer. Contains a PCA internally used reference to an individual element of the Remote Command Array. The Executer doesnot use this field; it passes it as such on to Reply & Report. 3.1.3 EXE_N. EXEcuter Name. Contains the name of the Executer that gets this EXEcuter Interface. All Executers can be the same code; only the context (variables, stack) on which they operate make that one Executer distinguishes itself from another. Quick is to be seen as an Executer as well. 3.1.4 D_PTR. Data buffer Pointer. Contains a reference to a shared memory data buffer used as data/parameter input to the CoMmanD's that will be called by the Executer. The Executer itself doesnot use the buffer's contents; it passes it on as such to the application (executable) code. 3.2 CMD_I. The formal parameter list sent by the Executer while calling a CoMmanD routine (RF application). 3.2.1 D_PTR. Data buffer Pointer. Contains a reference to a shared memory data buffer containing the data/parameter(s) input to the CoMmanD that got called by the Executer. 3.2.2 SEQ_I. SEQuence Identifier. Contains the reference to the table of the currently executing sequence (CMD_Nn). 3.2.3 SC_P. SequenCe Pointer. Contains the SEQuence array element number of the currently executing CoMmanD. 3.2.4 RM_PTR. Return Message buffer PoinTeR. Contains a reference to a shared memory data buffer that will receive this CoMmanD's Return Message. 3.3 RM_I. Return Message Interface. Returned by a CoMmanD, used uniquely by the Executer to decide upon further sequence continuation. 3.3.1 C_STA. Command execution STAtus. The execution return value of a CoMmanD. It is enumerated as follows: C: Continue sequence. (no error; succeeded execution) S: Stop sequence. (sequence obsolete; therefore stop it; succeeded execution) A: Abort sequence. (execution error; faulty state; not succeeded) 3.4 RR_I. The formal parameter list sent by the Executer to the Reply & Report process, by RPC (?). 3.4.1 RCA_P. Remote Command Array entry Pointer. A reference to an individual element of the Remote Command Array. Passed on from the Kernel to Reply & Report by the Executer which doesnot use this data. 3.4.2 CLA_A. Command Level Attribute (Absolute). Return Message detail qualifier, fixed by database and used by Reply & Report for qualification of this Return Message to the presentation level software as a Report. 3.4.3 CLA_R. Command Level Attribute (Relative). Return Message detail qualifier, depending on current execution level of the CoMmanD. Used by Reply & Report for qualification of this Return Message to the presentation level software as a Reply. 3.4.4 EXE_N. EXEcuter Name. Contains the name of the Executer that created this Reply/Report Interface. 3.4.5 RR_PTR. Reply/Report buffer Pointer. References the shared memory buffer that contains the Reply/Report generated by an RF application CoMmanD call of the Executer. 3.5 CMD_Nn. Flat table, generated by ORACLE and describing a sequence or sequence of sequences of RF application CoMmanDs. 3.5.1 SAA_M. Sequence Absolute Attribute Maximum. Contains the value of the index of the last element of the following sequence structure array. Used as "error out" branch label and testing of valid calculated branch after a "switch class" CoMmanD. 3.5.2 SEQ. SEQuence. Array of structures. Each element is a step in this sequence. 3.5.2.1 C_A. Command Attribute. Distinguishes between classes of CoMmanD's. Enumerated as follows: FL: First/Last. Command is code, not operating on RF hardware. Generates "Sequence start / terminated / aborted" messages; does sequence dependent initialization / cleanup. E: Executable. Command is code, operating on RF hardware. S: Switch. Command is code, not operating on RF hardware, capable of modifying the current sequence order. Uses data from the directly previously executed CoMmanD as input, to- gether with its private (static) database for changing the executer's sequence step counter. C: Complex. Command is a CMD_Nn table, not code. A: Abort. Command is code, operating on RF hardware. Puts RF hardware in a safe state after execution failure of (nested) CMD_n's. 3.5.2.2 CMD. CoMmanD. Points to either executable RF application code (CMD_n) or another sequence (CMD_Nn) ORACLE flat table. 3.5.2.3 CLA_A. Command Level Attribute Absolute. Fixed level attribute of this RF application executable CoMmanD. Used as a Return Message qualifier by Reply & Report. 4 Executer algorithm (simplified). Initialization and recursion. Initialize: Scratchpad: Global: CMD_A := EXE_I.D_PTR^.CMD_A LRM_P := Request (heap) buffer for local use. Stack: CMD_NT_test := EXE_I.CMD_NT CMD_NT_entry := 0 C_C_L := 2 Allow +1 for suppression of all but Start & End messages. RR_I: EXE_N := EXE_I.EXE_N RCA_P := EXE_I.RCA_P Loop_0: Case CMD_NT_test.SEQ[ CMD_NT_entry ].C_A of "A", "E", "S", "FL": ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Execution phase ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ END "C": Stack: CMD_NT_test CMD_NT_entry C_C_L Initialize: CMD_NT_test := CMD_NT_test.SEQ[ CMD_NT_entry ]. CMD 1) CMD_NT_entry := 0 C_C_L := C_C_L +1 1) END CMD_A := EXE_I.D_PTR^.CMD_A Check if Kernel wants me to abort. Goto Loop_0 Note: 1) These are from the previously stacked values. Execution phase. IF CMD_A = True AND CMD_NT_entry < ( CMD_NT_test.SAA_M -1 ) CMD_NT_entry := CMD_NT_test.SAA_M -1 Initialize: CMD_I: SEQ_I := CMD_NT_test SC_P := CMD_NT_entry RM_PTR:= Request shared memory Out-buffer. CASE CMD_NT_test.SEQ[ CMD_NT_entry ].C_A of "E": D_PTR := EXE_I.D_PTR RR_I: RR_I.CLA_R := C_C_L "FL", "A": D_PTR := Address of CMD_A RR_I: RR_I.CLA_R := C_C_L -1 Send these type of Return Messages even if 1 level deeper! "S": D_PTR := LRM_P RR_I: RR_I.CLA_R := C_C_L RR_I: CLA_A := CMD_NT_test.SEQ[ CMD_NT_entry ]. CLA_A RR_PTR := CMD_I.RM_PTR Pass control to CMD_n with CMD_I Upon return: CASE RM_I.C_STA of "A": CMD_A := True CMD_NT_entry := CMD_NT_test.SAA_M -1 Redundant, but leave for security reasons! END "S": CMD_NT_entry := CMD_NT_test.SAA_M END "C": IF CMD_NT_entry < CMD_NT_test.SAA_M Increment CMD_NT_entry IF CMD_NT_entry ò CMD_NT_test.SAA_M IF C_C_L > 2 Unstack: C_C_L CMD_NT_entry CMD_NT_test Increment: CMD_NT_entry IF C_C_L ó 2 ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Finishing off ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ END END execute phase: Copy command Return Message into local buffer with: CMD_I.RM_PTR and LRM_P Pass RR_I to Reply & Report RETURN Finishing off. SEND last command Return Message: Pass RR_I to Reply & Report. Prepare dummy RR_I for Reply & Report indicating that this Executer has finished its part of the job and inviting Reply & Report to check whether the R_C_A slot, occupied by this Order can be released. Initialize: RR_I: RCA_P := EXE_I.RCA_P <Ä¿ CLA_A := 0 1) ³ Characteristic CLA_R := 0 1) ³ of this EXE_N := EXE_I.EXE_N ³ dummy RR_I. RR_PTR := EXE_I.RCA_P <ÄÙ Send RR_I to Reply & Report. Release EXE_I.D_PTR Shared memory In-buffer. IF EXE_I.EXE_N = QUICK Release EXE_I.CMD_NT IF LRM_P <> nil Release LRM_P END. Note: 1) Level Attribute of "0" means "Order doesnot want the message." (See: Proposal for solving the Reply & Report problem, algorithm for Reply & Report.) 5 Executer Interfaces. Kernel Ä> Executer. ÚÄÄÄÄÄÄÄÄÄÄ¿ ³ EXE_I ³ ÆÍÍÍÍÍÍÍÍÍ͵ ³ CMD_NT ³ CoMmanD Name/Table. ÃÄÄÄÄÄÄÄÄÄÄ´ ³ RCA_P ³ Remote Command Array Pointer. ÃÄÄÄÄÄÄÄÄÄÄ´ ³ EXE_N ³ EXEcuter Name. ÃÄÄÄÄÄÄÄÄÄÄ´ ³ D_PTR ³ Data PoinTeR (shared memory In-buffer). ÀÄÄÄÄÄÄÄÄÄÄÙ Executer <Ä> CMD_n. ÚÄÄÄÄÄÄÄÄÄÄ¿ ³ CMD_I ³ Executer ÄÄ> CMD_n. ÆÍÍÍÍÍÍÍÍÍ͵ ³ D_PTR ³ Data PoinTeR. ÃÄÄÄÄÄÄÄÄÄÄ´ ³ SEQ_I ³ SEQuence Identifier (contains: CMD_Nn). ÃÄÄÄÄÄÄÄÄÄÄ´ ³ SC_P ³ Sequence Counter Pointer. ÃÄÄÄÄÄÄÄÄÄÄ´ ³ RM_PTR ³ Return Message PoinTeR (shared memory Out-buffer). ÀÄÄÄÄÄÄÄÄÄÄÙ Contents of D_PTR: Class of³Contents of D_PTR: CMD_n: ³ ÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ FL ³ Pointing to CMD_A flag. E ³ Pointing to input buffer. S ³ Pointing to copy of Return Message of ³ directly previously executed CMD_n. A ³ Pointing to CMD_A flag. C ³ nil. ÚÄÄÄÄÄÄÄÄÄÄ¿ ³ RM_I ³ CMD_n ÄÄ> Executer. ÆÍÍÍÍÍÍÍÍÍ͵ ³ C_STA ³ Command execution STAtus. ÀÄÄÄÄÄÄÄÄÄÄÙ enumerated: Continue sequence. Stop sequence. Abort sequence. Executer Ä> Reply & Report. ÚÄÄÄÄÄÄÄÄÄÄ¿ ³ RR_I ³ ÆÍÍÍÍÍÍÍÍÍ͵ ³ RCA_P ³ Remote Command Array Pointer. ÃÄÄÄÄÄÄÄÄÄÄ´ ³ CLA_A ³ Command Level Attribute (Absolute). ÃÄÄÄÄÄÄÄÄÄÄ´ ³ CLA_R ³ Command Level Attribute (Relative). ÃÄÄÄÄÄÄÄÄÄÄ´ ³ EXE_N ³ EXEcuter Name. ÃÄÄÄÄÄÄÄÄÄÄ´ ³ RR_PTR ³ Reply/Report buffer PoinTeR. ÀÄÄÄÄÄÄÄÄÄÄÙ 6 Executer storage. Executer global and local scratch pad. ÚÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Global ³ ÆÍÍÍÍÍÍÍÍÍÍ͵ ³ CMD_A ³ CoMmanD Abort flag. ÃÄÄÄÄÄÄÄÄÄÄÄ´ ³ LRM_P ³ Last Return Message Pointer. ÀÄÄÄÄÄÄÄÄÄÄÄÙ ÚÄÄÄÄÄÄÄÄÄÄÄ¿ ³Local Stack³ ÆÍÍÍÍÍÍÍÍÍÍ͵ ³CMD_NTtest ³ CoMmanD Name Table test variable. ¿ ÃÄÄÄÄÄÄÄÄÄÄÄ´ ³ Execution ³CMD_NTentry³ CoMmanD Name Table entry value. à ÃÄÄÄÄÄÄÄÄÄÄÄ´ ³ level 2. ³ C_L_L ³ Current Command execute Level. Ù ÃÄÄÄÄÄÄÄÄÄÄÄ´ ³CMD_NTtest ³ CoMmanD Name Table test variable. ¿ ÃÄÄÄÄÄÄÄÄÄÄÄ´ ³ Execution ³CMD_NTentry³ CoMmanD Name Table entry value. à ÃÄÄÄÄÄÄÄÄÄÄÄ´ ³ level 3. ³ C_L_L ³ Current Command execute Level. Ù ÃÄÄÄÄÄÄÄÄÄÄÄ´ ³ ³ ³ ³ " " " " Executer buffers. ÚÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Buffer ³ ÆÍÍÍÍÍÍÍÍÍÍ͵ ³ Header ³ Buffer header. ÃÄÄÄÄÄÄÄÄÄÄÄ´ ³ ³ ³ Data ³ Buffer contents. ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÙ Input data as well as outgoing return messages to Reply & Report are stored in circular buffers. Manipulation is done via GetBuf, PutStr, GetStr, RelBuf routines similar as with the G64 controllers. The same buffer can be sent along several CMD_n's in a sequence. 7 Executer ORACLE flattable. ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ CMD_N0 ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ SEQ ³ SEQuence ÃÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄ´ element: ³C_A³ CMD ³CLA_A³ ÆÍÍÍØÍÍÍÍÍÍØÍÍÍÍ͵ 0 ³FL ³CMD_0 ³ 1 ³ First ÄÄÄÄÄ¿ ÃÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄ´ ³ 1 ³ E ³CMD_1 ³ 1 ³ ³ ÃÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄ´ ³ 2 ³ S ³CMD_2 ³ 1 ³ ³ ÃÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄ´ ÀÄ> Reserved 3 ³ C ³CMD_N1³ ³ ÃÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄ´ ÚÄ> slots. 4 ³ E ³CMD_3 ³ 1 ³ ³ ÃÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄ´ ³ 5 ³ A ³CMD_4 ³ 1 ³ Last - 1 ÄÄ´ ÃÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄ´ ³ 6 ³FL ³CMD_0 ³ 1 ³ Last ÄÄÄÄÄÄÙ ÃÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄ´ ³ SAA_M ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ Field definitions. SEQ: SEQuence. Array of structures. Each element is a step in this sequence. C_A: Command Attribute. Distinguishes between classes of CoMmanD's. FL: First/Last. Command is code, not operating on RF hardware. Generates "Sequence start / terminated / aborted" messages; does sequence dependent initialization / cleanup. E: Executable. Command is code, operating on RF hardware. S: Switch. Command is code, not operating on RF hardware, capable of modifying the current sequence order. Uses data from the directly previously executed CoMmanD as input, to- gether with its database for changing the executer's sequence step counter. C: Complex. Command is a CMD_Nn table, not code. A: Abort. Command is code, operating on RF hardware. Puts RF hardware in a safe state after execution failure of (nested) CMD_n's. CMD: CoMmanD. Points to either code (CMD_n) or another sequence (CMD_Nn) table. CLA_A: Command Level Attribute Absolute. Fixed level attribute of this CoMmanD. Used as a selector by Reply & Report. SAA_M: Sequence Absolute Attribute Maximum. Label (index) of the last element in this sequence structure array (here: 6). Used as "error out" branch label and testing of valid calculated branch after a "switch" CoMmanD. 8 Execution examples. This assumes the situation that the switch class command CMD_2 decides to continue, without skipping. The RR_A of the order to the PCA was set to 2; messages from the higher detail level of CMD_N1 sequence have been suppressed (except for the start and end messages of the latter). No execution error occurred, hence the abort command (CMD_4) terminated without effect. Start of sequence: CMD_N0. Message of CMD_1. Switching to step: 3. Start of sequence: CMD_N1. End of sequence: CMD_N1. Message of CMD_3. End of sequence: CMD_N0. Case of execution error in a CMD_n in the sequence of CMD_N1, all other parameters the same: Start of sequence: CMD_N0. Message of CMD_1. Switching to step: 3. Start of sequence: CMD_N1. Faulty situation in CMD_n. although RR_A = C_C_L! Abort of sequence: CMD_N1. secures sequence CMD_N1 Abort of sequence: CMD_N0. secures sequence CMD_N0 Case of switch deciding to re-execute CMD_1 and then to stop the current sequence: Start of sequence: CMD_N0. Message of CMD_1. Switching to step: 1. Message of CMD_1. Switching to step: 6. End of sequence: CMD_N0. Case of execution code CMD_1 deciding that the sequence has become obsolete and to stop the current sequence: Start of sequence: CMD_N0. Message of CMD_1. End of sequence: CMD_N0.