gtpc3m1l | Concepts and Structures |
The TPF record hold facility reserves a data record for the exclusive use of an Entry to make a modification to the record. Recall, from Reentrant Programs, the distinction between a program and a process; an Entry is a TPF process, the animation of a program. Several different Entries can be the animation of the same program. A record hold table consists of a list of records being held by active Entries in a CPC.
When an Entry issues a find and hold macro, the record hold table is checked to determine if the record is already held. If not, the file address of the requested record is placed in the record hold table and the request is serviced. However, if another Entry is holding the requested record, the current request is not serviced until the record is not held by the other Entry. The Entry requesting the record is blocked and observes an I/O delay; however, multiprogramming is employed to keep an I-stream engine occupied with useful processing.
All record hold requests are serviced on a first-come, first-served basis. A file address is removed from the record hold table when an unhold request is processed and there are no further requests to hold this record. The fact that a record is being held does not prevent another Entry from reading the same record. The record hold table is checked only when servicing find and hold, file and unhold, and unhold macro requests.
In the TPF system, a data record is locked (held) at the record level. Applications should observe the rule of holding only one record at a time, thereby avoiding deadlock. (Observe that the TPF system minimizes overhead, in the name of performance, by not enforcing this rule.) Applications with a requirement to lock data represented by complex chains of records are not easily accommodated within the TPF system. The chances of an application program encountering an I/O delay because of a data record being locked can be minimized through application design, through the allocation of data records across all modules, and by locking on single records rather than on larger data sets. (Contrast this with the IBM MVS system that locks on a data set through the OLD parameter in the job control language (JCL) that references the data set.) Practice has shown that although record hold checking is performed on each hold-type request, seldom does a held record cause the processing of another Entry to be delayed.
Record holding within an environment of a single CPC is conceptually simple and permits Entries running in a multiprogramming environment to share the same database. Perhaps a better viewpoint within the TPF system is to consider the programs that process related but essentially independent data. An analogy is a large dining room, a large buffet table full of multiple selections of a variety of food (the data), plenty of tables to seat hungry people (the programs), where everyone gets plenty to eat with few queues, little waiting, and vanishing hunger.
A review of the material in Central Processing Complex (CPC) is recommended at this point. In particular, review Figure 13.
Within a loosely coupled complex, record holding must be coordinated among the CPCs that form the complex. Conceptually, the idea is the same as coordination among I-stream engines within a CPC and among Entries in an I-stream engine. That is, a large database is accessed by an identical set of application programs available for execution (animation) in each of several CPCs. However, a private main storage in each of the CPCs adds some complexity to the underlying details. Simply placing file addresses, essentially lock indicators, in a main storage record hold table is no longer adequate to communicate the need for exclusive control of a record. Because the records are still located on shared modules and any indicator held in main storage is private to a CPC, all Entries in the complex must have access to the lock indicator, but not every Entry is processed by the same CPC. Therefore, the main storage of a CPC cannot be used as the communication vehicle among these Entries. The external lock facility (XLF) and associated software support (introduced in TPF System Processing Milieu) moves the record hold table to storage in a shared external facility that is accessible by all CPCs. The communications vehicle is now represented by shared storage in this external facility.