A program uses an SRB to initiate a process in another address
space or in the same address space. The advantage of scheduling an
SRB is that an SRB routine is asynchronous in nature and runs independently
of the scheduling program. This advantage makes SRBs very useful
in the following situations, where the scheduling program does not
need to wait for the SRB routine to finish running:
- To process in parallel
In a multi-processor 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.
- Run with the same cross-memory environment as the scheduling program
and with a DU-AL that is a copy of the scheduling program's DU-AL
as it exists when the scheduling program issues the SCHEDULE or IEAMSCHD
macro, with the exception of any subspace entries in the scheduling
program's DU-AL. The system does not copy subspace entries. In this
way, the SRB routine and the scheduling program can access the same
address and data spaces.
- To avoid serializing
Because the SRB represents a separate
unit of work, the unit of work that schedules the SRB routine is not
serialized or delayed while the SRB routine completes its function.
The following types of delays can usually be avoided:
- Page fault resolution
- Address space swap-ins
- Lock suspensions - wait time
- To account for resources
Because the SRB represents a separate
unit of work, the processor time spent accomplishing that work can
be charged to:
- The address space in which the SRB is running
- The enclave in which the SRB is running
- The client address space in which the SRB is running
- To make changes of state
In some instances, a program might
be running in some state that prohibits it from performing certain
functions. The following are examples of when that program might schedule
an SRB routine:
- A program in a disabled state cannot request a suspend-type lock.
The program can avoid these restrictions by scheduling an SRB to complete
the function.
- A program running in cross-memory mode requires functions that
only can be performed when in non-cross-memory mode. The program
can schedule an SRB that places the SRB routine in non-cross-memory
mode.
- To raise the priority of a process
Because the SRB represents
a separate unit of work, the SRB has its own dispatching priority.
It can run at a priority higher than that of any address space or
at the priority of the address space in which it is scheduled.
It
can also run at a preemptable priority, allowing work at an equal
or higher priority to have access to the processor.
Although a major advantage of SRBs is their asynchronous nature,
you can use WAIT and POST or SUSPEND and RESUME to synchronize the
processing of the SRB routine with the scheduling program.