- 20 -
3.4 Timing
The Real Time record is maintained by P60, which increases it by 1.048576
seconds every time a CLOCK RFI is detected.
The "Notional Elapsed Time" record is also maintained by P60, which adds
1.048576 seconds every time a CLOCK RFI is detected to those members of
the quartet V9P1O4M5 which correspond to PHU registers currently showing
a peripheral hold-up.
The Run Time record for each program is recorded (in. the quartet V5P104M5)
in much the same way as in the non-Time-sharing Director (N 3.2): i.e.
whenever a program is interrupted, its run time is increased by the scaled
value (including overflow) of the first subsequent CLOCK reading, which is
always taken a fixed length of time after entering the Director. Before
a program is resumed its run time is decreased by the scaled value (excluding
overflow) of the last CLOCK reading, and also by a "path correction" which
represents the sum of two time intervals: from taking this last reading
until obeying EXITD, and from the next interruption until the first
subsequent CLOCK reading - the latter is fixed, the former depends on the
path through Director: variations are introduced by the need to execute
program loops both for determining the return priority (stage (1 of
Short path) and for restoring the Nest and SJNS (end of Long path).
To calculate the path corrections, a similar stratagem is employed to
that used for timing the non-Time-sharing Director (N 3.2). A program
is written which obeys OUT 3 consecutively twice, the second execution
being delayed by a peripheral lockout, so that the difference of the two
run times should be negligible. The Director is subtly modified so that
(a) it disregards a peripheral. hold-up (the sequence V0P104; K5; OR;
becomes V0P104; K5; ERASE;) and (b) instead of recording real time, it
records the actual unsealed clock readings, using the "path corrections"
to provide a count of "number of interrupts" (by making each path
correction equal to -1). Thus, the difference of the two OUT 3 readings
provides the program with an accurate record of the "path times" which
elapsed between them, and of the number of interrupts. The path corrections
can be obtained by dividing one into the other. By suitably varying the
priority at which the program is run, and the numbers of items it has in
its Nest and STNS when interrupted, the loop variations can be calculated
as well. The Director can be made to follow any path by using the
"Sense switch" positions in the RFIR (D16-21) - when any of these is non�
zero, the Long path is followed, and one or more of them may be used to
set appropriate values in V14P0.
3.5 V-stores of P0
(V5,8,15,23 contain constants)
V0 =Real time V17 =LIV (non-zero if set)
V1-4=Dumps of Q4-7 V18 =NOUV (ditto)
V6 =Last clock reading, scaled V19 =EDT (do.)
V7 =Priority of interrupted program V20 =OUT (do.)
V9-12=BA quartet V21 =Spurious interrupt indicator
V13 =Time expired indicator V22 =RESET (non-zero if set)
V14 =Negative, or return priority V24-27=TAB word quartet
V16 =FLEX (non-zero if set) V28 .Director/Program marker
- 21 -
4. Hold-ups and Subprograms
4.1 Types of hold-up. Action following EDT.
Director writing is characterised by the need to devise schemes for
arranging internal "hold-ups", analogous to the interruptions which hold
up ordinary programs. This need arises particularly in parts of the
Director concerned with input/output (N.2.3).
The removal of any of these hold-ups is almost invariably signalled by
an EDT interrupt. The action of the Director after an EDT is therefore
largely concerned with looking at all the hold-ups recorded, deciding
which of them can be removed, and restarting the process which was held
up.
The types of activities which have to be held up in the Time-Sharing
Director fall into 5 main classes:
(a) Operations on W magnetic tapes. These can be classed as standard
function sequences carried out by Director on several different
peripherals. They are independent of priority.
(b) The "consolidation" within the core store of the areas belonging to
the different programs occupying the machine, and the interchanging
of priorities consequent on the ending of A-programs (and TINT V) -
this can be regarded as a continuing process, held up when it has
nothing to do, and also when some of its activities are delayed by
lock-outs (see 2.4).
(c) "Queued" operations. When several programs, possibly including the
Director, wish to make use of the same peripheral unit, it is
natural to deal with them on a "first come, first served" basis -
i.e. each request for a transfer on this unit is placed in a queue.
As each transfer ends, the corresponding item in the queue is removed,
the queue moves up one place., and the next transfer is started.
These operations are, by their nature, independent of priority. A
new transfer request is placed at the end of the queue and
subsequently cannot change places with any other item in the queue.
(d) The initiation of A-program input. This does not refer to the detailed
business of program input, which is handled by subprograms but to the
Director's overall task of keeping the machine supplied with A-programs.
This may be regarded, like (b), as a continuing process which is held
up at times when there is no suitable priority available.
(e) Operations within the Director which have to be given the same relative
priority (in respect of the order in which hold-ups are removed) as the
programs on whose behalf these operations are carried out. These
operations are "subprograms" and include such activities as program
input, the allocation of storage to a program being input, the
allocation of peripheral units for program input or to programs already
input, as well as input-output operations carried out by the Director
on behalf of a program.
- 22 -
The subroutine P5, which is entered whenever V19P0 (the EDT marker) is found
to be non-zero, takes account of all these possibilities by examining in turn
the recorded hold-ups within all these classes.
The appropriate subroutines, in order of entry, are:-
(a) P100 (deals with W magnetic tapes)
(b) P105 (consolidate store, etc.)
(c) P59 (deal with Flexowriter queue)
P155 (deal with OUT 8 queue)
etc.
(d) P120 (initiate A-program input)
(e) P11 (deal with subprograms).
The order in which these subroutines are entered is important, for the
following reasons:-
- P100 must precede P11, as the change in status of a magnetic tape unit
from W to L by P100 may remove a holdup from a subprogram, which will be
detected by P11.
- P105 must precede all the queue operations, because some of them may be
held up awaiting store moves or priority changes (see reference to P103 in
2.4). For the same reason P105 has to precede P11. P105 should also
precede P120, because the initiation of the input of a new A-program may be
made possible by the actions of P105.
- the queue operations must precede P11, because the end of a queued
transfer may remove a subprogram hold-up.
- P120 should precede P11, since the former sets up a subprogram to be
re-activated by the latter.
These subroutines are described in detail below.
After all these subroutines have been entered P5 ends by carrying out the
examination of the PHU store prescribed in 1.3. Should this lead to the
clearing of any parts of the PHU store, marker bits are set in D47 of the
appropriate members of V13P104M5, and a predetermined return priority number
may be left in V14P0 - the coding should be consulted for the algorithm used.
4.1.1 Dealing with W Magnetic Tapes (P100)
This process, which is almost identical to that used in the non-Time�
Sharing Director (N6.4), ensures that any magnetic tape unit assuming
status W undergoes a sequence of operations which are carried out by
one or more of a numbered set of "bricks". Each magnetic tape unit
has its own "brick indicator" (B.I) which indicates which bricks remain
to be executed for that unit; the last brick executed must alter the
status of the unit from W to something else. The value of the B.I. is
specified when the unit is given status W, and the specified bricks
are then obeyed in numerical sequence. The bricks are numbered 1-6
and carry out the following functions:-
Brick 1 - Count blocks back to BT.
Brick 2 - Skip back to BT without counting.
Brick 3 - Read label block.
Brick 4 - Alter status from W to U, typing full details.
Brick 5 - As brick 4 changing status from W to L.
Brick 6 - Alter status from W to L, typing nothing.
- 23 -
Entry to a brick, which occurs whenever the unit concerned is
not busy, is arranged by P100, which provides the brick with
the only parameters it requires - the unit number in C6 and M6.
No brick is permitted to alter Q6. The entry points to bricks
1-6 are labels 1-6, respectively, of P101.
A brick must be entered over and over again until its job is
complete - this is decided by the brick itself, which returns
control to P100 at one re-entry point (5P100) when it is not
completed, another (6P100) when it is - in the latter case P100
updates the B.I. to ensure that the right brick is entered next.
The B.I. for unit n, which is stored in D0-23 of V(n-6)P100,
contains the floating point number
2-a + 2-b + 2-c + ...
where a, b, c,.., are the numbers of the uncompleted bricks.
The label block of the tape on unit n is read into the three
words which begin at V(3n-18)P101.
To alter the status of a magnetic tape unit to W, it is necessary
to obey
JS10P100;
with the unit number in M6, and the non-normalised brick
indicator in N1 - in this form D33=1 indicates brick 1 is to be
obeyed, D34=1 indicates brick 2, D35=1 brick 3, etc.
D24 of the B.I. word holds a Parity indicator, and D25-47 the
block count used by brick 1.
4.1.2 Action of P105
Some mention of the actions involved in store consolidation and
priority interchange was made in 2.4. These actions are dealt
with by P105, which performs the following steps:-
(1) Examines and clears a marker (V0P105).and skips step (2)
if it was zero.
(2) For each priority in turn, effects any specified store
movement (but only if the area involved is not locked out)
and any specified priority interchange (but only if neither
of the areas assigned to the specified priorities are locked-
out).
"Store movement" involves not only moving the program in the
store and altering its BA (in V9P0M5) but also modifying any
absolute addresses referring to locations within the "moved
area" which may be stored as parameters in any of the "Queues"
(see 4.1.3) or any of the Subprogram hold-up parameter stores
(see 4.1.5).
"Priority interchange" involves the following:-
- interchanging bits of V0P104.
- 24 -
- interchanging quartet members in the V-stores of P104, and
(with additional complications) in V9P0M5 and V24P0M5.
- altering, if need be, the priority numbers recorded in V7P0,
V0P52 and V0P120, and similar locations.
- interchanging the sets of subprogram parameters for the pairs
of subprograms pertaining to the priorities involved (see
4.1.5).
- altering accordingly the subprogram numbers contained within
those "Queue" transfer parameters which are holding up any
of the affected subprograms (see 4.1.3, 4.1.5).
(3) Re-sets up all the priority interchanges required by the A-
program concept, regarding only those A priorities which are
neither occupied by B programs, nor already committed to inter�
change with B, or B-occupied, priorities, as eligible for
interchange. Any new priority interchange set up in this step
also causes V0P105 to be set non-zero.
(4) If there are gaps in the store, either between two A-programs
or between the top of the store and the nearest A-program, sets
up the store move which will close up the gap nearest the top
of the store. Any new move set up causes V0P105 to be made non�
zero.
(5) Carries out a similar service for B-programs as (4) does for
A-programs, relative to the bottom of the store.
(6) If V0P105 is now non-zero, returns to step (2).
(7) For each priority, causes the hold-up bit D43 of the correspond�
ing member of V25P104M5 to be set or cleared according to
whether or not there is still an outstanding store move or
priority interchange at that priority. If there are any out-
standing, V0P105 is left non-zero.
4.1.3 Queued transfers
The format of transfers in any queue (e.g. the Flexowriter queue,
dealt with by P59, the OUT 8 tape queue dealt with by P155, or the
magnetic drum queue dealt with by P143) is usually one 48-bit
parameter word per transfer, with a word consisting of all ones
immediately after the last parameter word to indicate the end of the
queue.
Because of the number of different types of transfer it has to cater
for, the Flexowriter queue is more interesting than others. The three
types are:-
(a) Queries: the absolute initial and final addresses of the query
are stored in D16-31 and D32-47 of the parameter word. D0 is 1,
D1 to 5 are all zeros, and D12-15 contain the number of the
subprogram (0-9 - see 4.1.5) which called the query. The sub-
- 25 -
program number is required because a query, unlike the other
types of Flexowriter transfer, holds up whatever process
calls it, in order to wait for the answer, and therefore that
process has to be part of a subprogram. P59 must remove
this hold-up when the query has been answered and the answer
checked, and to do this it must know the subprogram number.
(b) Parametric transfers: the parameter word has D0-15 = all
ones, D16-31 initial (absolute) address, D32-47 final
(absolute) address.
(c) Message words. A transfer of this type causes the actual
contents of the parameter word to be typed. Any parameter
word which does not fall into one of categories (a) or (b) is
of this type. Clearly it is not permitted to insert into the
Flexowriter queue any message word which starts with the
character (octal) 40 - this would make it look like a Query
parameter word - or with the characters (octal) 7777 - this
looks like a parametric transfer or, if the word consists of
"all ones", like the end of the queue (for this reason the
"dummy" second word of one-word tape identifiers is always
typed out as D0-2=0, D3-47=all ones, rather than the "all
ones" form it takes in the non-Time-Sharing Director).
Another implication is that if any Flexowriter message is inserted
into the queue in the form of a string of message words, all these
words will be typed out, even if some word before the last one
contains an EM; although each individual word is typed to EM.
Hence the character octal 75 acts as "End Word" rather than "End
Message" in this context.
A trap which it is easy to fall into is to try and use the same
area of store for a message which one wishes to have typed out in
slightly different forms (e.g. varying a priority number) on
different occasions, as a query or parametric transfer. This may
lead to the message being altered, and re-inserted into the queue,
at a time when a similar parametric transfer, of the previous
version of the message (now corrupted), is still waiting to be typed
further up the queue. Such messages must either be typed as strings
of message words, or must exist in their different form: in
different locations (e.g. the "REACT" queries in P2).
Subroutines exist for inserting parameter words into the Flexowriter
queue. They are:-
(a) P8 - insert query. On entry, N1 contains the final absolute
address, N2 the initial absolute address and N3 a "number of
extra links to be preserved" parameter identical to that
required by entry 2 to P10 (see 4.1.6). This subroutine, like
P10, requires the appropriate subprogram parameters in Q4 and
M5, and like P10 it suspends the subprogram, which is not re�
entered until the query has been typed, answered, and checked.
(The subroutine P140, for inserting items into the Magnetic
Drum queue, is similar).
- 26 -
(b) P7 - insert parametric transfer. On entry, N1 contains the
final absolute address, N2 the initial absolute address.
(c) P6 - insert a string of parameter words, given in N2 (the
first), N3, N4 etc. into the Flexowriter queue. The number
of words is given in N1.
The Flexowriter queue is contained in the V-stores of P6.
The only "tight loop" which can occur in Director is when
the Flexowriter queue gets filled up, and the Director sticks
in P6 until all the parameter words have been put in the
queue.
P6 is used by P7 and P8, but otherwise usually only for
inserting strings of message words.
As mentioned in 4.1.2, the parameter words in any queue may have
to be modified by P105 because they contain absolute addresses
referring to moved areas, and/or subprogram numbers altered by a
priority interchange.
4.1.4 Action of P120
All that P120 does, when it is entered following EDT, is to
examine all the priority levels to see if there is one which is
suitable for A-program input. To be suitable, it must be an
unoccupied A-level, and there must-be no lower priorities
occupied by A-programs.
If a suitable priority cannot be found, P120 takes no further
action. However, when it does find one, P120 initiates the
main subprogram of that priority (see 4.1.5) before returning
control to P5, so that it will be re-entered by P11.
At this stage no peripheral or store reservation has been made
for the A-program. It is possible that the subprogram set up
by P120 will not be re-entered: this could occur if TINT T is
obeyed, calling for the input of a B-program at the same priority,
before this subprogram can be re-entered - in such a case P52
(TINT T) would overwrite the subprogram parameters, left by P120,
with others of its own.
Assuming the subprogram is re-entered, it checks first that
there is no A-program input at any other level, by examining
V0P120. Then it checks that the required complement of core
storage and peripheral devices are available. Only after
ensuring that these requirements can be met (an activity having
the same priority as the program to be input) does the subprogram
reserve the required amount of store, pre-allocate the required
peripherals, set the "A-program present" bit in V0P104, and the
priority number in V0P120, prior to continuing with the program
input process. Otherwise the subprogram is closed down.
- 27 -
4.1.5 Subprograms - P11
The subprogram system of the Time-Sharing Director bears superficial
resemblances to that of the non-Time-Sharing Director (N.6.2) but is
more flexible and powerful, mainly because it can exploit the
availability of the full depth of the SJNS. It was devised by
A. Doust.
There are ten subprograms. Each represents an activity within the
Director which can be temporarily suspended for one of the following
reasons:-
(a) the subprogram requires access to a busy peripheral device or a
locked-out area of store, or
(b) the subprogram is waiting for the end of a "queued" peripheral
transfer, or
(c) the subprogram is waiting to be allocated a magnetic tape with
a specified identifier, or
(d) the subprogram is waiting to be allocated some other type of
peripheral unit.
The ten subprograms are numbered 0-9. Subprograms 0 and 1 belong
to the Director - the former is used by P4 for typing out the "TINT"
query, the latter is used by OUT 8 and by TINT M. The remaining
eight are allocated to the four priorities: thus, subprograms
2p+2 and 2p+3 belong to priority p. The first of the two belonging
to any priority, known as the "Main" subprogram, is used for
activities which require the program at that priority level to be
held up - e.g. allocation of peripheral units, program input - while
the second subprogram, which is used for such activities as OUT 8
and magnetic drum transfers, does not automatically hold up its
program. Usually it relies on ordinary core store lock-outs to hold
up the program if needed, but it can also use D44 of V25P104M5
(see 2.4).
V1-40 of P11 contain a table in which the states of all the sub�
programs are recorded. The action of P11 is to examine this table,
looking at the entries corresponding to all the subprograms in
increasing numerical order (thus giving the correct relative priorities
to subprograms 2-9). Any subprogram whose suspension can be
terminated is immediately re-entered, and remains in control until
for some reason it returns control to P11, which then resumes the
examination of the table at the entry for the next subprogram. P11
ends when all the subprograms have been dealt with in this way.
Each subprogram owns 4 words in the table, known as SHUL, SHUP,
SHUP* and SHUL*. For subprogram n, these are respectively V(n+1),
V(n+11), V(n+21) and V(n+31) of P11. While a subprogram is
suspended, D32-47 of its SHUL contains a link which, when placed
in SJNS and EXIT 1 is obeyed, will cause the subprogram to be re�
entered at the correct point. SHUL* contains up to 3 extra items
from the SJNS which can be preserved while the subprogram is held
up, and which will be restored by P11 to the SJNS before the sub-
- 28 -
program is re-entered. SHUP and SHUP*, and D0 of SHUL, contain
parameters which indicate the reason for the suspensions, as
follows:-
Type of Suspension D0 of SHUL SHUP SHUP*
(a) Peripheral 0 D0-15=Busy unit, or zero Unused
D16-31, 32-47 locked-out
area (absolute addresses)
(b) Queued transfer 0 D0=1 Unused
(c) Identifier required 1 First word of identifier Second word
(D3-47 if "one
word")
(d) Unit required 1 D0=1, D1-41=0, D42-47 = Unused
type number
SHUP* may be used by any subprogram to hold private parameters except
when an "identifier required" suspension occurs.
The items in the table may have to be modified and interchanged by
P105 (see 4.1.2).
Q4 is used to address this table. While dealing with subprogram n,
its contents are:-
C4 = n
I4 = 1
M4 = AV(1+n)P11
When subprogram n is re-entered from P11, Q4 will contain these
parameters, and the subprogram must ensure that when it subsequently
returns control to P11, Q4 is in status quo, so that P11 may resume
its examination of the table at the right point (though this rule, as
will be seen below, has its exceptions).
When examining the entry in the table for any subprogram, P11 acts as
described below:-
- if SHUL is zero: the subprogram is ignored. SHUL=0 indicates it
is closed down and inactive.
- if SHUL is positive: the subprogram is entered if, and only if,
SHUP is positive, the store area defined by D16-47 of SHUP is not
locked-out, and the unit whose number (if non-zero) is in D0-15
of SHUP is not Busy. The contents of SHUP are left in Q7 when the
subprogram is re-entered.
Since words 0-31 of the Director are never locked out, re-entry to
the subprogram is guaranteed if SHUP is zero. This fact is made
use of when setting up subprograms, and also at the end of any
- 29 -
"queued" transfer which is holding up a subprogram: in this case
the appropriate subroutine (e.g. P59, P143) will clear the SHUP
associated with the subprogram whose number is stored with the
transfer parameters (see 4.1.3).
- if SHUL is negative: the subprogram is entered if the first octal
character of SHUP is 40 (N.B. no tape identifier can start with this
character),and if there exists a "U" unit of the type whose number
is given in D42-47 of SHUP. The unit number is left in C6 and M6,
and its descriptor is unaltered. If the first octal character of
SHUP is not 40, SHUP and SHUP* are assumed to contain a required tape
identifier (if this is one-word, SHUP* contains (octal)
07 77 77 77 77 77 77 77.) In this case, the subprogram is entered
if, and only if, V0P101 is non-zero - this is the marker indicating
that a new tape identifier is present (see 4.1.1) - with the contents
of SHUP and SHUP* left in N1 and N2 respectively. It is up to the
subprogram to see if it is the one required, using P58 (see 4.1.6).
When it is about to re-enter subprogram 2n or 2n+1, P11 first sets the
value (n-1) in M5 (for subprograms 2-9, this is the corresponding priority
number). If the subprogram is 2, 4, 6 or 8, D47 of V25P104M5 is cleared.
Finally a succession of items are transferred to SJNS:
- a link which when used by either EXIT 1 or EXIT 2 will return
control to the correct point in P11 - this makes the subprogram
look like a subroutine of P11.
- if SHUL* is non-zero, D32-47 of SHUL*
- unless D0-31 of SHUL* are all zero, D16-31 of SHUL*
- if non-zero, D0-15 of SHUL*
- D32-47 of SHUL
(at least 2, and not more than 5, items)
SHUL is now cleared, and the subprogram is entered by obeying EXIT 1.
By virtue of this clearing of SHUL (and also the clearing of D47 of
V25P104M5 if it is the main subprogram of a priority - see 2.4), the
subprogram will automatically have been closed down when it returns
control to P11, unless it has reloaded SHUL. The loading of SHUL,
SHUP, etc., is usually carried out by P10, and is described in the
next section
4.1.6 Subprograms continued - P10 etc.
The actions of P11 in respect of a subprogram which it causes to be re�
entered are, besides entering it at the correct location (SHUL), to transfer
a link, and the non-zero items in SHUL*, to the SJNS, and also to leave the
contents of SHUP, and sometimes SHUP*, in suitable places. The subroutine
P10 exists largely to perform the opposite functions, that is, when a sub�
program is to be suspended, to load SHUL, SHUL* and SHUP with the correct
parameters (SHUP*, as will be seen, is dealt with by P58 only), and then to
return control to the routine (usually P11) of which the subprogram is a
"subroutine".