Note: In this topic, the term program refers
to a task or service request block (SRB) routine.
The main advantage to using the latch manager is that you can reduce
contention for resources by dividing them into smaller segments and
assigning individual latches to those segments. Your application can
assign latches to resources in whatever way it desires. The more
you can divide resources and assign individual latches to them, the
more likely it is that you will reduce contention for those resources
and increase the overall performance of your application.
For example, if a requestor needs to update a data structure that
contains several sub-structures, and those sub-structures are used
by several programs running concurrently in the same address space,
the requestor could obtain the address space local lock to serialize
access to the entire data structure. Because there is only one address
space local lock, the system suspends other requestors until the lock
is released. On the other hand, if your application were to assign
a latch to each sub-structure (there is no system-imposed limit on
the number of latches you can assign to resources), requestors could
serialize access to individual sub-structures within the data structure
at the same time.
How to use the callable services explains how to use the latch manager services
to serialize resources that your application uses. Before reading
the information, understand the following terms:
- Latch
- A structure that the latch manager uses to track and handle
requests to obtain, release, and purge latches. The application associates
each latch with a resource, then requests access to the resource by
calling the Latch_Obtain or the 64-bit Latch_Obtain service with the
appropriate latch number.
- Latch identity
- An attribute that consists of thresholds, a printable description
of the latch's usage, and other attributes as defined by the latch
identity entry in the appropriate language related macro - ISGLMC,
ISGLMASM, or ISGLMPLI.
- Latch set
- A set of latches that an application can use to serialize its
required resources. The application calls the Latch_Create or the
64-bit Latch_Create service to create a latch set.
- Latch set creator
- An application that calls the Latch_Create or the 64-bit Latch_Create
service to create a set of latches. Programs that run as part of
the application can use the latches to serialize required resources.
- Latch set token
- An 8-byte area that identifies a latch set. The latch manager
returns the latch set token to the caller of the Latch_Create or the
64-bit Latch_Create service.
- Latch token
- An 8-byte area that identifies an individual latch request.
The latch manager returns the latch token to the caller of the Latch_Obtain
or the 64-bit Latch_Obtain service.
- Requestor
- A program that calls a latch manager callable service to:
- Request ownership of a latch, or
- Release an owned latch, or a pending request to obtain ownership
of a latch.