By TNL: GN22-0498
Initial conditions:
THAT
items from a free list without using the lock/unlock routines.
This is especially likely since the lock/unlock routines
storage. The lock/unlock routines discussed previously allow
simultaneous
a time. In such a situation, multiple additions and a single
deletion to the list may all occur simultaneously, but
a chain of pointers containing free storage buffers, multiple
deletions along with additions can occur simultaneously. In
this case, the removal cannot be done using the
unlock example. Assume that the first two elements are at
locations A and B, respectively. If one program attempted
to remove the first element and was interrupted between
the fourth and fifth instructions of the LUNLK routine,
the list could be changed so that elements A and
first two elements when the interrupted program resumes
execution. The
the value B into the header, thereby destroying the list.
The probability of the occurrence of such list destruction
can
counter that indicates the number of times elements have
been added to the list. The use of a 32-bit counter
events occur, in this exact sequence:
1. An unlocker is interrupted between the fetch of the
pointer from the first element and the update of the
header.
2. The list is manipulated, including the deletion of the
32
- 1 additions
to the list are performed. Note that this takes on the
order of days to perform in any practical situation.
3. The element referenced in step 1 is added to the list.
4. The unlocker interrupted in step 1 resumes execution.
The routines ADD
simultaneous additions and removals at the head of a chain
of pointers.
The list consists of a doubleword header and a chain of
elements. The first word of the header contains a pointer
314
to the first element in the list. The second word of the
header contains a 32-bit counter indicating the number of
additions that have been made to the list. Each elemen t
contains a pointer to the next element in the list. A zero
value indicates the end of the list.
The following chart describes the free-pool-list
Function
ADD
element is at
location
Decrement the second word of the header by one.
The list is empty.
header to the value of the
contents of location A.
Use element A.
The following routines allow enabled code to perform the
free-pool-list manipulation described in the chart.
ADD
Initial conditions:
GR2 contains the address of the element to be added.
GR4 contains the address of the header.
ADDQ LM
TRYAGN
BCTR
TRYAGN
HEADER
DECREMENT THE
DELETE
Initial conditions:
GR4 contains the address of the header.
DELETQ LM 2,3,0(4) GR2,GR3 =
HEADER
TR
LR 1,3
BNE TRYAGN
Note that the LM instructions at locations ADDQ and
DELETQ would have to be
for the rule that a doubleword fetch starting on a
another
and not a combination of the two, is obtained.