In z/OS®,
dispatchable units of work are represented by two kinds of control blocks:
Task and service request blocks.
- Task control blocks (TCBs)
- These control blocks represent tasks executing within an address space,
such as user programs and system programs that support the user programs.
A
TCB contains information about the running task, such as the address of any
storage areas it has created. Do not confuse the z/OS term TCB with the UNIX® data structure
called a process control block or PCB.
TCBs are created in response
to an ATTACH macro. By issuing the ATTACH macro, a user program or system
routine begins the execution of the program specified on the ATTACH macro,
as a subtask of the attacher's task. As a subtask, the specified program can
compete for processor time and can use certain resources already allocated
to the attacher's task.
The region control task (RCT), which is responsible
for preparing an address space for swap-in and swap-out, is the highest priority
task in an address space. All tasks within an address space are subtasks of
the RCT.
- Service request blocks (SRBs)
- These control blocks represent requests to execute a system service routine.
SRBs are typically created when one address space detects an event that affects
a different address space; they provide one mechanism for communication between
address spaces.
The routine that performs the function or service is called
the SRB routine ; initiating the process is called scheduling an
SRB; the SRB routine runs in the operating mode known as SRB mode.
An
SRB is similar to a TCB in that it identifies a unit of work to the system.
Unlike a TCB, an SRB cannot "own" storage areas. SRB routines can obtain,
reference, use, and free storage areas, but the areas must be owned by a TCB.
In a multiprocessor environment, the SRB routine, after being scheduled, can
be dispatched on another processor and can run concurrently with the scheduling
program. The scheduling program can continue to do other processing in parallel
with the SRB routine. As mentioned earlier, an SRB provides a means of asynchronous
inter-address space communication for programs running on z/OS.
Only
programs running in a mode of higher authority called supervisor state can
create an SRB. These authorized programs obtain storage and initialize the
control block with things such as the identity of the target address space
and pointers to the code that will process the request. The program creating
the SRB then issues the SCHEDULE macro and indicates whether the SRB has global
(system-wide) or local (address space-wide) priority. The system places the
SRB on the appropriate dispatching queue where it will remain until it becomes
the highest priority work on the queue.
SRBs with a global priority
have a higher priority than that of any address space, regardless of the actual
address space in which they will be executed. SRBs with a local priority have
a priority equal to that of the address space in which they will be executed,
but higher than any TCB within that address space. The assignment of global
or local priority depends on the "importance" of the request; for example,
SRBs for I/O interrupts are scheduled at a global priority, to minimize I/O
delays.