SATN-39 Abstract An S-task is a SHARP APL task which obtains its input
and delivers its output as character-vector values
of a shared variable,
but is otherwise identical to a T-task.
Introduction An S-task is a SHARP APL task which obtains its input
and delivers its output as character-vector values
of a shared variable,
but is otherwise identical to a T-task.
The S-task interface permits any program which is capable
of communicating with the Sharp Shared-Variable Processor
(i.e., any program which can share variables)
to communicate with SHARP APL in the manner
of a user at a terminal.
This description of the S-task interface is
from the point of view of APL programs;
in order to prepare non-APL programs for this purpose,
refer to SIN-48 SHARP APL Installation-written
Auxiliary Processors,
and to the DSECT TYIOMODE contained
in the APE APL source libraries.
SHARP APL Processor Characteristics In order to communicate with any processor with shared variables, a definition of its characteristics is required. To this end, the SHARP APL Processor is designed to behave as follows:
Establishing an S-task When SHARP APL has been installed with appropriate configuration parameters, it connects itself to the shared variable processor as processor 1. An S-task may then be created by offering to share a variable with processor 1: 1 ⎕svo 'name' where name is a vector of 15 or fewer characters denoting the name of a variable to be used for the interface. The account which offers the variable to processor-1 is known as the initiator of the S-task. When resources permit, the S-task controller will allocate the necessary tables, obtain a clear workspace, assign a task identification number, and then match the offer to share. When the degree of coupling becomes 2, the task is in the same state as a T-task after a terminal has become connected to the system, but before the user has signed on. The normal system limits on the number of tasks
which can be created by a single user also apply to S-tasks;
if the total number of tasks signed on with the initiator’s
account number has reached this limit,
a new offer to processor 1 will be ignored,
and the variable must be re-offered after the number
of tasks has been reduced.
The initiator of an S-task is analogous to the initiator
of an N-task in that the S-task may be terminated
at any time by a ⎕bounce .
Communication with an S-task S-task input and output is in the form of APL character vectors of four or more elements. The first four characters of each value contain control information which must be present. The first two of these characters are not used at the present time, and must be binary zeroes, i.e., ⎕av[0 0] . (Note: index origin 0 is assumed throughout this discussion.) The third element is used to denote commands to the S-task controller from the initiator and responses from the S-task controller (see below); ⎕av[0] in this position indicates that the value is to be passed on to APL. The fourth element is used to indicate the meaning of the value which is being passed from SHARP APL to the initiator. For example, the first input to an S-task will normally be an attempt to sign on to SHARP APL: name←⎕av[0 0 0 0],')1234:key' Assuming that the account number and key are valid, the response returned in name will be: prefix,'2134)22.13.00 04/01/80 sueblue' i.e. the normal indication of a successful signon. Otherwise the response might be: prefix,'incorrect signon' or prefix,'number not in system' The important point to note is that,
for every value set in the interface variable,
APL or the S-task controller will respond
with one or more values in reply.
APL Output Blocking While APL sends output a line at a time, the S-task controller will catenate several lines together in order to reduce the number of shared variable accesses required. Each line is preceded by two characters which define the length of the line including the two length characters. Each line must be “deblocked” by a code segment such as the following: read:→(0<⍴block)/take ⍝ branch if block contains lines block←name ⍝ receive output from APL take:k←256⊥⎕av⍳2↑block ⍝ length of next line output←2↓k↑block ⍝ next line block←k↓block ⍝ drop line from block Qualification of Values Received from APL The fourth element of prefixes received from APL indicates the meaning of the rest of the vector. Common combinations are shown in figure 1. If mode←(8⍴2)⊤⎕av⍳output[3] then the elements of mode have the following meaning when their values are 1:
Control Characters Certain character values have meanings of a control nature when passed to or from APL as normal input or output. Common control characters are:
S-task Controller Commands The third element of values set by the initiator is a command to the S-task controller as follows:
S-task Controller Responses The S-task controller responds to each non-zero command (except for accounting information which returns an integer vector) with a four-element character vector (preceded by a two-character length) whose third element indicates the result of the command:
S-task Termination An S-task will be terminated by any of the following:
Figure 1: Typical Model Combinations Mode Index
First appeared as SHARP APL Technical Note 39, The SHARP APL S-task Interface, 1981-06-01.
|