Direct task

From NDWiki
Jump to navigation Jump to search

A Direct Task is a routine running on one of the free interrupt levels 2, 5, 6, 7, 8 or 9. A direct task may be started by an RT program by activating (by the instruction MST PID, for example) the interrupt level where the direct task is placed. Otherwise, a direct task will run independent of the SINTRAN III system, and a direct task cannot use monitor calls, files or other facilities in SINTRAN III. If a direct task is running on a higher interrupt level than the SINTRAN III monitor (usually level 3), the SINTRAN III monitor will not be restarted before the direct task has terminated, by giving up the priority (by the WAIT instruction, for example).

The Implementation of a Direct Task into a SINTRAN III System

First, the direct task routine must be loaded into a segment using the RT loader. Then, the routine should be fixed in memory by using the monitor call FIX or FIXC. Finally, the ENTSG command or monitor call should be used to enter a direct task or a driver routine into the operating system. The given page table must be different from the page table set by the RT loader. This means that the segment may be reached through two page tables, simultaneously, with different protect settings. The ENTSG monitor call will always read, write and fetch permitted in the page table.

The start address will be put into the P register of the specified interrupt level.

A new driver routine on the interrupt level 10, 11, 12 or 13 may be entered into a SINTRAN III system in the same way as a direct task, but data fields and entries in the logical number tables must be established at system generation time, or by the use of MACM before the SINTRAN III system is started.

Calling RT Programs from Direct Tasks

When a direct task wants to start an RT program, a subroutine in SINTRAN III can be called:

       LDA (ELEM
       JPL I (RTDIR       % SINTRAN III Subroutine
ELEM,  RTPRG; 0; 0; 0; 0;

The A register points to an element of 5 locations. The first is a pointer to the RT description of the RT program, the rest is used as working space for RTDIR.

Since RTDIR is on page table 0, and the parameter element is also on page table 0, this mechanism can be used directly only from direct tasks on page table 0. However, using a system routine on level 14, it can also be used from other page tables, for example page table 3.


% Code on page table 3
LDA RTDSC                 % Pointer to RT description
IRW 160 DT                % Set reguister on level 14
LDA I (PPRTD;IRW 160 DP   % Address of routine on level 14
LDA (40000; MST PID       % Activate level 14

The address PPRTD is placed among the globale variable in the lower part of the resident part of the system (approx. address 160 octal)

The number of RT programs which can be started simultaneously from direct tasks must be defined at system generation time.

Activation of Direct Tasks from Interrupts

A general driver to activate direct tasks has been implemented. Each level has a logical number with a corresponding data field. The number are:

440 octal - level 6
441 octal - level 7
442 octal - level 8
443 octal - level 9

Levels 5 and 2 cannot be activated this way. If, for example, level 7 should be activated by a certain CAMAC interrupt, the monitor call ASSIG can set up the connection:


In this case, all patching is avoided. If the direct task should be started by a non-CAMAC interrupt, the data field pointer must be put into the proper IDENT or EXTEND table.

The driver increments a location in the data field each time an interrupt occurs. This can be used by the direct task to detect whether some interrupts have come too fast to be processed by the direct task. If the direct task wants to check this, the exit sequence can be as follows:

DISP 4;INTEGER LEV, COUNT;PSID   % in data field
IF = 0 THEN LEV; *MCL PID        % give up level
GO START                         % next execution

Page table 3 is available for direct tasks. On page table 0, the available area starts on the first page following the memory resident section and goes to location 65777 octal.


Norsk Data Document ND–060.050.06 SINTRAN III USERS GUIDE , section 4.6