The control program constructs a unique list for each qname, rname,
and scope combination it receives. When a task makes a request, the
control program searches the existing lists for a matching qname,
rname, and scope. If it finds a match, the control program adds the
task's request to the end of the existing list; the list is not ordered
by the priority of the tasks on it. If the control program does not
find a match, it creates a new list, and adds the task's request as
the first (and only) element. The task gets control of the resource
based on the following:
- The position of the task's request on the list
- Whether or not the request was for exclusive or shared control
The best way to describe how the control program processes the
list of requests for a resource is through an example.
Figure 1 shows the status of a list built for a qname, rname,
and scope combination. The S or E next to the entry indicates that
the request was for either shared or exclusive control. The task represented
by the first entry on the list always gets control of the resource,
so the task represented by ENTRY1 (
Figure 1,
Step 1) is assigned the resource. The request that established ENTRY2
(
Figure 1, Step 1) was for exclusive control,
so the corresponding task is placed in the wait condition, along with
the tasks represented by all the other entries in the list.
Figure 1. ISGENQ Macro
Processing
Eventually, the task represented by ENTRY1 releases control of
the resource, and the ENTRY1 is removed from the list. As shown in Figure 1, Step 2, ENTRY2 is now first on the list,
and the corresponding task is assigned control of the resource. Because
the request that established ENTRY2 was for exclusive control, the
tasks represented by all the other entries in the list remain in the
wait condition.
Figure 1, Step 3, shows the status of the
list after the task represented by ENTRY2 releases the resource.
Because ENTRY3 is now at the top of the list, the task represented
by ENTRY3 gets control of the resource. ENTRY3 indicates that the
resource can be shared, and, because ENTRY4 also indicates that the
resource can be shared, ENTRY4 also gets control of the resource.
In this case, the task represented by ENTRY5 does not get control
of the resource until both the tasks represented by ENTRY3 and ENTRY4
release control because ENTRY5 indicates exclusive use.
The control program uses the following general rules in manipulating
the lists:
- The task represented by the first entry in the list always gets
control of the resource.
- If the request is for exclusive control, the task is not given
control of the resource until its request is the first entry in the
list.
- If the request is for shared control, the task is given control
either when its request is first in the list or when all the entries
before it in the list also indicate a shared request.
- If the request is for several resources, the task is given control
when all of the entries requesting exclusive control are first in
their respective lists and all the entries requesting shared control
are either first in their respective lists or are preceded only by
entries requesting shared control.