Table 1 shows the resource serialization services that are available on MVS, the functions that each service can perform, and where to find more information about each service:
Service | Function | Reference |
---|---|---|
ISGENQ, ENQ/DEQ/RESERVE |
|
|
Latch Manager Callable Services: ISGLCRT, ISGLCR64, ISGLOBT, ISGLOB64, ISGLREL, ISGLRE64, ISGLPB64, ISGLPRG, ISGLPR64, ISGLID, ISGLID 64 | Serialize resources (such as control
blocks or data sets) within a single address space or across several
address spaces in a single MVS system with minimal overhead. Authorized programs only. Synchronize the execution of programs. |
Global resource serialization latch manager |
Locking (SETLOCK macro) | Serialize system resources (such as MVS system queues or control blocks) within a single MVS system or address space. | Locking |
IXLLOCK | Enables authorized applications to obtain shared
or exclusive serialization on user-defined logical resources. You
can also implement your own locking protocols through the inclusion
of user data. IXLLOCK is specific to Sysplex environments and provides high speed cross sysplex sharing. The cost is that it is much harder to use then ENQ and provides less external controls |
For guidance information, see z/OS MVS Programming: Sysplex Services Guide. For the programming environment, see z/OS MVS Programming: Sysplex Services Reference. |
If you need to synchronize the execution of programs, Table 2 can help you determine which services to choose. The table compares the attributes of the Pause, Transfer, and Release callable services, the WAIT and POST macros, and the SUSPEND and RESUME macros.
Pause, Release, and Transfer | WAIT and POST | SUSPEND and RESUME |
---|---|---|
Can change the dispatchability of a task or SRB. | Can change the dispatchability of a task but not an SRB. | Can change the dispatchability of a task or SRB. |
Can be called from TCB mode or SRB mode. The interfaces are the same for both modes, and the caller of the services does not need to know whether it is in TCB or SRB mode. | WAIT can only be issued in TCB mode. POST can be issued in TCB or SRB mode. The interfaces used in each mode may be different. | Can be used in both TCB and SRB mode. The invoking program must know if it is in task or SRB mode. |
Can release a task or SRB before it is paused | Can post a task before it waits. | Cannot resume either a task or SRB before it is suspended. |
An authorized caller can pause and release any task or SRB in the system. | Requires the ECB and task being posted to be in the current primary address space for a non-cross memory post. | No control element is needed. |
A task or SRB can only pause on a single Pause Element (PE) at a time. | A task may wait on multiple ECBs. If the wait count numbers are posted, the task is made ready. | Not applicable. |
The Transfer service can simultaneously pause one task or SRB and release another. | There is no single service with comparable capability for WAIT and POST. | There is no single service with comparable capability for SUSPEND and RESUME. |
The Transfer service can release a task or SRB and immediately pass control to the released task or SRB. | There is no single with comparable capability for WAIT and POST. | There is not single service with comparable capability for SUSPEND and RESUME. |
Both authorized and unauthorized callers can use the services. | Both authorized and unauthorized callers can use the macros. | Only authorized callers can use the macros. |
The system ensures that pause elements are not reused improperly, thus avoiding improper releases caused by unexpected termination or asynchronous ABENDs. | Callers can incorrectly post a task out of the wrong wait due to post, or even the wrong task, if managed improperly, through task termination. | Callers can resume the wrong task or resume a task from the wrong suspend. Because no control element serializes SUSPENDs and RESUMEs, neither the system nor the user can easily detect any reuse problems. |
Local lock is not used by the services; therefore, its usage has no negative effect on local lock contention. | Services using local lock can cause additional contention. | Services may use local lock, and cause some additional contention. |
Control the parallel execution of units of work (task or SRB) within the same MVS address space or across MVS address spaces. Allow programs to wait (pause) until one event (RELEASE or TRANSFER) has completed. | Control the parallel execution of tasks. Allow programs to wait until one or more events have completed (event completion function). | Control the parallel execution of request blocks (RBs) and SRBs within a single MVS system or address space. |
If you need to serialize resources across multiple MVS systems, you must use the ISGENQ macro or the ENQ/DEQ/RESERVE macro. However, if your application requires resources that reside in a single address space or MVS system, you can choose one of the following services: the CMS lock, ISGENQ, ENQ/DEQ macros, latch manager, the local lock, or IXLLOCK. Table 3 can help you determine which of the serialization services is most appropriate for your application.
Feature | CMS Lock | Local Lock | Latch Manager | ENQ/DEQ Macros | ISGENQ Macro |
---|---|---|---|---|---|
Number of items you can serialize individually | One | One | Many | Many | Many |
Access allowed | Exclusive | Exclusive | Exclusive and shared | Exclusive and shared | Exclusive and shared |
Scope | Single system | Address space | Single system or address space | Address space, single system, or multiple systems | Address space, single system, or multiple systems |
Cross memory environment | Any PASN, any HASN, any SASN | Any PASN, any HASN, any SASN | Any PASN, any HASN, any SASN | Any PASN, any HASN, any SASN | Any PASN, any HASN, any SASN. |
Unit of work | Task or SRB routine | Task or SRB routine | Task or SRB routine | Task | Task |
Minimum authorization | Supervisor state and PSW key 0 | Supervisor state and PSW key 0 | Supervisor state or PSW key 0-7 | Problem state with any PSW key, supervisor state or PSW key 0-7 or APF-authorized for certain types of requests | Problem state with any PSW key, supervisor state or PSW key 0-7 or APF-authorized for certain types of requests |
Set-up required | None | None | Application must create one or more latch sets | None | None |
Default recovery action | Release owned and pending requests | Release owned and pending requests | Release pending requests, but not owned requests | Release owned and pending requests | Release owned and pending requests |
Other techniques, such as those that make use of the compare and swap (CS), compare double and swap (CDS), and test and set (TS) instructions, are provided to perform specialized serialization. For information about those instructions, see Principles of Operation.
The capabilities listed in Table 3 are explained below:
For performance reasons, and because SRBs might not want to release owned latches when errors occur, the system does not release owned latch requests during task or address space termination. The system does, however, release pending latch requests when the requestor's home address space terminates.
In all cases, the application programmer needs to understand the default recovery action for the service that is used. For more information on how to create a recovery environment, see the information that discusses recovery and termination.