Action
Function
Header
Header Header
Contains
Contains Contains
Zero
Positive Negative
Value ValueLIFO LOCK (The incoming element is at location AI SRR is free. SRR is in use. Store the contents Set the header to of the header into location A +4.
a negativevalue. Store the address A into the header.
Use theSRR. WAIT; the ECB is at location A.
LIFO UNLOCK Error Someone is The list is empty.
waiting for theStore zeros into SRR. Move the the header. The
pointer from theSRR is free. "last in" element into the header. POST; the ECB
is in the"Iast in" element. The following routines allow enabled code to perform the
actions described in the previous chart.
LIFOLOCK Routine:
Initial conditions:
GRI contains the address of the incoming element.
GR2 contains the address of the header.LLOCK SR 3,3 GR3 ::;: 0 ST 3,0(1) INITIALIZE THE ECB
LNR0,1 GRO = A NEGATIVE VALUE TRYAGN CS 3,0,0(2) SET tHE HEADER TO A NEGATIVE V ALUE IF THE HEADER CONĀ TAINS ZEROS BE USE DID THE HEADER CONTAIN ZEROS? ST 3,4(1) NO, STORE THE VALUE OF THE
HEADERINTO THE POINTER IN
THE INCOMING ELEMENTCS 3,1,0(2) STORE THE ADDRESS OF THE
INCOMING ELEMENTINTO THE
HEADER
LA3,0(0) GR3 = 0 BNE TRYAGNDID THE HEADER GET UPDATED?
WAIT (1)YES, WAIT FOR THE RESOURCE; THE ECB IS IN THE INCOMING
ELEMENTUSE [ANY INSTRUCTION] LIFO UNLOCK Routine:
Initial conditions:
GR2 contains the address of the header.LUNLK L 1,0(2) GRI ::;: THE CONTENTS OF THE
A
B
EXIT
LTR 1,1
BM B
L0,4(1) CS 1,0,0(2) HEADER DOES THE HEADER CONTAIN A
NEGATIVEVALUE? NO, LOAD THE POINTER FROM THE "LAST IN" ELEMENT AND STORE IT
IN THE HEADER
BNE A DID THE HEADER GET UPDATED?POST (1) YES, POST THE "LAST IN" ELEMENT
B EXITCONTINUE SR 0,0 THE HEADER CONTAINS A NEGATIVE CS 1,0,0(2) VALUE; FREE THE HEADER AND
BNE ACONTINUE [ANY INSTRUCTION] Page of GA22-7000-4 Revised September 1, 1975
By TNL: GN22-0498
Note that the L 1,0(2) instruction at location LUNLK
would have to beCS 1,1,0(2) if it were not for the rule
that a full word fetch starting on a word boundary must
fetch the word such that if anotherCPU changes the word
being fetched, either the entire new or the entire old value
of the word, and not a combination of the two, is obtained.
LOCK/UNLOCK with FIFO Queuing for Contentions
Both a header and a free element are associated with theSRR. Each program using the SRR must provide an element
regardless of whether contention occurs. The element proĀ
vided by the program becomes the new free element, and
the old free element becomes the program's new current
element. The free element is initialized to contain a posted
ECB. In the example, the element need be only a single
word. In some cases, the element could be made larger to
include a reverse pointer to the previous element.
The following chart describes the action taken forFIFO LOCK and FIFO UNLOCK routines.
FunctionFIFO LOCK (The incoming element is at location A) FIFO UNLOCK Action
Store the address A into the header.WAIT; the ECB is at the location addressed by the old contents of the
header.POST; the ECB is at the location that
you specified as anelement when you locked. The following routines allow enabled code to perform the
actions described in the previous chart.
FIFOLOCK Routine:
Initial conditions:PNTRS is a doubleword containing two pointers. The first
word is a pointer to the current element owned by this
program. The second word is a pointer to the previous
element owned by this program.
GR3 contains the address of the header.FLOCK L 2,PNTRS GR2 = ADDRESS OF THE SR ST L
1,11,0(2) 1,0(3) CURRENT ELEMENT
GRI =ZERO INITIALIZE THE ECB
GRI =CONTENTS OF THE OLD ELEMENT TRY AGN CS 1,2,0(3) STORE THE ADDRESS OF THE USE BNE TRY AGN CURRENT ELEMENT INTO THE
HEADER, CURRENT ELEMENTBECOMES NEW FREE ELEMENT
STM 1,2PNTRS SAVE THEADDRESSES IN GRI
WAIT (1), AND GR2 FOR FUTURE USE, CURRENT ELEMENT BECOMES PREVIOUS ELEMENT, OLD FREE ELEMENT BECOMES CURRENT ELEMENT
GRICONTAINS THE ADDRESS OF THE ECB [ANY INSTRUCTION] I:(' < , k Appendix I. Number Representation and Instruction-Use Examples 313
Function
Header
Header Header
Contains
Contains Contains
Zero
Positive Negative
Value Value
a negative
Use the
LI
waiting for the
pointer from the
is in the
actions described in the previous chart.
LIFO
Initial conditions:
GRI contains the address of the incoming element.
GR2 contains the address of the header.
LNR
HEADER
THE INCOMING ELEMENT
INCOMING ELEMENT
HEADER
LA
WAIT (1)
ELEMENT
Initial conditions:
GR2 contains the address of the header.
A
B
EXIT
LTR 1,1
BM B
L
NEGATIVE
IN THE HEADER
BNE A DID THE HEADER GET UPDATED?
B EXIT
BNE A
By TNL: GN22-0498
Note that the L 1,0(2) instruction at location LUNLK
would have to be
that a full word fetch starting on a word boundary must
fetch the word such that if another
being fetched, either the entire new or the entire old value
of the word, and not a combination of the two, is obtained.
LOCK/UNLOCK with FIFO Queuing for Contentions
Both a header and a free element are associated with the
regardless of whether contention occurs. The element proĀ
vided by the program becomes the new free element, and
the old free element becomes the program's new current
element. The free element is initialized to contain a posted
ECB. In the example, the element need be only a single
word. In some cases, the element could be made larger to
include a reverse pointer to the previous element.
The following chart describes the action taken for
Function
Store the address A into the header.
header.
you specified as an
actions described in the previous chart.
FIFO
Initial conditions:
word is a pointer to the current element owned by this
program. The second word is a pointer to the previous
element owned by this program.
GR3 contains the address of the header.
1,1
GRI =
GRI =
HEADER, CURRENT ELEMENT
STM 1,2PNTRS SAVE THE
WAIT (1)
GRI








































































































































































































































































































































