Abstract:
A system and method for controlling access to data in storage which is shared by a plurality of processors are disclosed. The shared storage is located outside of main storage of each of the processors and stores a lock file. The lock file comprises a plurality of control fields containing access administration information (ZVI) authorizing the processors to access the data when not currently being accessed by another processor and a status identification code (SKC) to indicate the status of the access administration information. In response to a data access request from one of the processors, the status identification code provided by the processor is compared to the stored status identification code. If the comparison indicates that the requesting processor is authorized to update the access administration information, the access administration information associated with the requesting processor for the type of data access request is written from the requesting processor to the shared storage without first reading the stored access administration information from the lock file. The status identification code in the storage is updated to indicate that the processor has updated the access administration information.

Description:
BACKGROUND OF THE INVENTION 
     The invention relates generally to computer systems and deals more particularly with control of access to shared data. 
     Executing multiple application programs in multiprocessor systems usually requires control information that specifies whether and on what conditions one of several processors may access shared data (for example, a record) and read and/or change it by write operations. 
     Once a particular processor has been authorized to read or write such a shared record, a lock instruction keeps the other processors from accessing the shared record at the same time. After the authorized processor has completed its operation on the shared record, an unlock instruction releases the record for further access requests. 
     According to the state of the art, a separately addressable table or database (referred to as a global lock table in English or as a lock file in the IBM VSE operating system) is provided for access administration and control. 
     The lock file for administration and control purposes has different control fields for the shared data or record to be accessed (FIG. 1). For access administration and control of the records, each control field contains information and is preceded by a search key (for example, A1, A2, A3) which is directly (identically) or indirectly associated with the search key (DA1, DA2, DA3) of the respective shared data (records 1, 2, 3). 
     When a particular shared record, for example, record 1, in the application program of a processor (for example, processor 2, FIG. 1) is addressed for reading or writing (by specifying the search key, for example, A1), the control field for this record is initially addressed by means of the lock instruction, using that search key. This causes the lock file to be blocked for competing access requests (in IBM operating system VSE, for example, by the instruction RESERVE DISK). Then the information of the addressed control field is read into the main memory of the requesting processor (read operation R) and it is determined whether the processor&#39;s access request may be granted. 
     If it is, the information of the control field is updated according to the request (or release) (update operation) and written back into the associated control field of the lock file (write operation W). The lock file is then released for further access operations (in IBM operating system VSE, for example, by the instruction RELEASE DISK). 
     If the request of the processor resulting in the lock instruction cannot be granted, the lock file is released for further access operations and control is returned back to the application program with a corresponding message or (after some time has passed) a renewed request is issued to the lock file by means of the search key. 
     In these steps, the execution of the read operation R requires a substantial amount of time t, roughly 40 to almost 50 per cent of the total time T, of the periods represented in FIG. 2. 
     Accordingly, a general object of the present invention is to reduce the administration and control time required to access a data object. 
     SUMMARY OF THE INVENTION 
     The invention is directed to an apparatus for and a method of controlling access to data in storage which data and storage are shared by a plurality of processors. Each of the processors has a local main storage. The shared storage is located outside of the main storage and stores a lock file. The lock file comprises a plurality of control fields containing access administration information authorizing the processors to access the data when not currently being accessed by another processor and a status identification code for the data to indicate whether another of the processors is currently accessing the data. Each of the control fields is associated with a corresponding data address. In response to a data access request from one of the processors, access administration information associated with the requesting processor for the type of data access request is written from the requesting processor to the shared storage without first reading the stored access administration information from the lock file. Next, the access administration information written by the processor is compared to the stored access administration information. If the comparison indicates that the requesting processor is authorized to access the requested data and if the status identification code indicates that no other processor is currently accessing the requested data, the status identification code in the storage is updated to indicate that the processor is currently accessing the data. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a schematic of a multiprocessor system according to the prior art with a shared data stock and a lock file for access administration and control purposes; 
     FIG. 2 is a prior art lock file time diagram for a read and a write operation in the multiprocessor system of FIG. 1; 
     FIG. 3 is a partial schematic diagram of a multiprocessor system with a shared data record and a lock file for an optimistic assumption-based access administration and control method according to the present invention; 
     FIGS. 4A, 4B are function diagrams illustrating the optimistic assumption-based method and taking account of application program and operating system operations; 
     FIG. 5 shows a group of control fields with a common status identification code; 
     FIG. 6 is a schematic time diagram for two processors accessing a record. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT 
     The invention works according to the optimistic assumption principle which is based on the fact that in many applications during which several processors compete for access to a shared record there is a high probability (exceeding 90%) that the content of the respective control field in the lock file, namely access administration and control data, will allow one of the processors to access the shared data or record immediately. If access rights are granted, it is highly probable that the content of the control field concerned has not been changed by other entries since the previous request for access was granted. 
     This high degree of probability is referred to as an &#34;optimistic assumption&#34; in the description below. It is assumed that the lock file control field most probably has the expected content. Special conditions apply only in exceptional cases. 
     For rapidly verifying the optimistic assumption, each control field in the lock file is associated with a status identification code SKC (see FIG. 3). 
     Assuming a read instruction for an account record with the number 007 is issued in an application program of a processor 2 (of seven). By using the search key &#34;007&#34; during the execution of the lock instruction, the part of the lock file containing the control field for record 007 is addressed for writing; in addition to the number 007, refer to 3-2 for instance, this control field 3-4 is associated with the status identification code SKC 3-3. By means of a write operation, access administration information, such as &#34;exclusive access right of processor 2 to the account record with the number 007&#34;, is entered in the control field. 
     It is optimistically assumed that the information may be written into the control field immediately, which would be the case if 
     a) the control field contains no information at all at that stage or 
     b) the control field information may be overwritten. 
     These possibilities are mirrored by the status identification code SKC in coded form. 
     As a result, by comparing the actual with the expected content of the status identification code associated with the control field, it is possible during writing to determine whether the write operation to be effected into the control field may be carried out without previously reading the content of the control field into the memory or local main storage 3-6 to 3-8 of the requesting processor. 
     Many data carriers containing the lock file, such as count key data disks (see IBM 3390 Storage Control Reference, IBM Manual GA 32-099) or other fast semiconductor technology-based equipment, which provide external memory space, permit tying the execution of a write operation (in this case into a control field of the lock file) to a particular condition. For count key data disks this may be, for example, a search key and a transfer-in-channel command in the channel program. In the present case, the status identification code SKC is initially examined to determine whether a write operation into the control field is permissible for a particular request. For this purpose, the expected and the actual content of the SKC code are compared with each other without a time-consuming SKC read operation into the main memory (local main storage) 3-7 of processor 2. Instead, as previously mentioned, a channel program or some other measure is used, so that the time-consuming read operation R (FIG. 2) is eliminated. 
     Thus, a channel program, processed within the channel sub-system, together with the conditional writing capability of a count key data disk are adequate means for implementing the various aspects of accessing (storing, writing comparing, updating and reading) of shared data in the shared storage 3-9. 
     If the examination of the status identification code SKC shows that the write operation into the control field for account record 007, refer to 3-2 for instance, may be executed, this write operation is carried out and the status identification code SKC is updated according to the write request. Thus, it is examined, for example, whether SKC is 0 (meaning the control field contains no access administration information, i.e., access rights have not yet been granted). If SKC is 0, the request is written into the control field and SKC is set to 1 (meaning the control field now contains access administration information, i.e. access rights have been granted). 
     Assuming the processing of account record 007 by the application program of processor 2 is now completed, then the access rights for this record should be returned. By using &#34;007&#34;, the unlock instruction addresses that part of the lock file for writing in which the control field for record 007 is contained. At this stage, it is optimistically assumed that the control field has not been updated since. This may be verified in that during the writing of the unlock instruction into the control field it is examined whether SKC still has the expected value-in this case, for instance, SKC=1. If it has, the write operation for the unlock instruction may be executed (this process is completed without reading information from the lock file into processor 2); alternatively, if the assumption does not apply, special measures will be required. 
     (This may be the case if SKC has since been set to another value, e.g., SKC=2, because record 007 is being or has since been read by another processor.) 
     In this manner the optimistic assumption does away in particular with the time-consuming read operation for the content of the control field into the main memory, as is required in prior art equipment. Where several processors compete for access to a shared data stock this leads to enormous time savings during program execution. In addition, by blocking the lock file on fewer occasions, the performance is noticeably increased, i.e. the waiting time for a request is considerably reduced. An example of two processors accessing a record is described in detail in conjunction with FIG. 6. 
     FIGS. 4A and 4B are function diagrams of the optimistic assumption-based method according to the invention, taking account of application program and operating system operations. These diagrams also consider exceptional cases which are outside the optimistic assumption. 
     The individual function blocks in the diagrams are numbered 4-0 to 4-20 (excluding 4-15); there is information specifying which steps are executed by the application program and which are executed by the operating system. 
     If shared data (e.g. a particular account record) is to be addressed by a search key (the account number) in step 4-0 (for performing a read or write operation), this will trigger the lock instruction on the part of the application program and on the part of the operating system, in step 4-1, the addressing of the control field associated with the data in the lock file. During the execution of the lock instruction it is decided in step 4-2 whether the optimistic assumption still applies. If it does, steps 4-3, 4-4 and 4-5 are carried out in an uninterruptable operation. In step 4-3, it is examined whether the content of the control field, the access administration information ZVI, may be changed by virtue of the status identification code SKC. If it may be changed, the administration information, i.e. the new ZVI, resulting from addressing the data (in 4-0) for a read or write operation is written into the control field. In step 4-5, the status identification code SKC is then updated. The sequence of the steps 4-3, 4-4 and 4-5 cannot be interrupted, which phenomenon is often referred to as &#34;atomic writing&#34;. After the new information has been successfully entered in the lock file, the operating system, after step 4-5, again branches to the application program where the addressed data may be accessed in step 4-6. If the application program returns its access rights in step 4-6-1 with an unlock instruction, step 4-7 is implemented which queries whether the optimistic assumption still applies. (Such a query may be used to limit unsuccessful access attempts to a predetermined number.) In the YES-branch of step 4-7 (analogous to steps 4-3, 4-4 and 4-5) the access rights are withdrawn in steps 4-8, 4-9 and 4-10 (the unlock instruction is carried out), i.e. a new ZVI is entered in the lock file. Upon completion of step 4-8 (querying the expected SKC), new access administration information ZVI is written into the control field if the query is positive, and the status identification code is updated accordingly in step 4-10, for example, to the effect that the control field is now empty and may be overwritten without having to be read later on. 
     Then, the operating system again branches to the application program. If the queries in step 4-3 and 4-8, respectively, turn out negative, a branch is taken to step 4-11 or 4-12, as in response to a negative answer to the query in step 4-2 or 4-7 &#34;does the optimistic assumption still apply?&#34;. In step 4-11 or 4-12 the validity of the optimistic assumption is again queried. In the case of a positive result, a branch is taken to step 4-3 or 4-8 after the control field has been read in step 4-13 or 4-14 and the current values of ZVI and SKC are known. In the NO-branch of step 4-11 or 4-12, the lock file is processed according to the prior art. In the NO-branch of step 4-11 (4-12), for example, this means that the lock file is initially blocked in 4-16 (4-21) and that, subsequently, in step 4-17 (4-22), the access administration information is read from the control field into the main memory. (It is expressly pointed out that when proceeding from the optimistic assumption, steps 4-16 (4-21) and 4-20 (4-25) are eliminated in particular. These steps are carried out only in standard (time-consuming) methods. In step 4-18 (4-23), the control field information ZVI is updated in the main memory. The updated control field information ZVI is written into the associated control field of the lock file in step 4-19 (4-24). Then, in step 4-20 (4-25), the lock file is released. In steps 4-16 to 4-20, a processor may be granted access rights, for example, to data addressed by a lock instruction. Upon completion of step 4-20, a branch is taken to step 4-6 in which the addressed data is accessed in the application program. 
     A program sequence analogous to that in steps 4-16 to 4-20 applies to the NO-branch of step 4-12. In this program branch (4-21 to 4-25) access rights previously allocated in response to a lock instruction may be withdrawn. 
     The optimistic assumption-based method according to the invention may be used for various applications. It may be employed, for example, for administering the access of several processors to a shared data stock or for file administration where several processors access a shared catalog. 
     In FIG. 3, each control field, in addition to the random address (006, 007, 008) of the data, is associated with a status identification code SKC 3-3. Also conceivable are applications (FIG. 5) for which a group (block) 5-1 of control fields, rather than each control field, are associated with a common status identification code SKC (5-2). (The data addresses in this example are A1, A2 and A3.) In this connection 
     SKC could be 0: block empty (all control fields empty), i.e. an access right may be granted immediately; 
     SKC could be 1: block not empty (at least one control field not empty), i.e. an access right may only be granted after detailed examination. (Since the last access to a control field, when SKC was set to 1, there has been no further access, for, otherwise, SKC would have been set to 2.) 
     Examples of different kinds of access authorization and control might read: &#34;This record may only be read by processor 3 or processor 4&#34; or &#34;this record may only be updated by processor 6&#34;, etc., etc. 
     FIG. 6 is a schematic time diagram illustrating how two processors at different times access a record addressable by the key &#34;007&#34; for executing a read instruction. The illustration distinguishes between the application program and the operating system for each processor. The different times at which operations are carried out or initiated are designated as t1 to t13. At the time t1, a read request is issued by processor 1 to record 007. This triggers a lock 007 instruction. For granting access to processor 1, it is examined at the time t2 whether the status identification code associated with the control field of record 007 in the lock file is 0. If it is (the optimistic assumption applies), the access administration information ZVI may be entered in the control field in response to the request without a read operation and the status identification code SKC may be set to 1. 
     By means of the access authorization granted at the time t2, record 007 may be accessed for reading at the time t3. At the time t4, processor 2 also wants to read record 007. This triggers a further lock 007 instruction. For granting processor 2 access, it is examined at the time t5 whether the status identification code for the control field of 007 is still 0. As it is not (the optimistic assumption does not apply, as the status identification code has already been set to 1 at the time t2), the access administration information ZVI of the control field for 007 and the SKC are read into processor 2 at the time t6. There it will be found that the status identification code is &#34;1&#34;. From the access administration information ZVI it is concluded that currently another processor has access to 007. At the time t7, optimistically assuming that SKC is still &#34;1&#34;, a further write operation into the control field for 007 will be attempted. In this case, the optimistic assumption applies, and at the time t7 the new ZVI is entered and the status identification code is set to &#34;2&#34;. At the time t8, processor 2 may read record 007. At the time t9, after completion of the read operation for record 007, processor 2 will give an unlock 007 instruction through the application program. This prompts the operating system, which optimistically assumes that SKC is still &#34;2&#34; to write data into the control field. As the optimistic assumption applies, the access right for processor 2 is cancelled at the time t10 and SKC is set to 3. At the time t11, the access rights for 007 requested by processor 1 at the time t1 are to be cancelled by an unlock 007 instruction. As a result, at the time t12, it is examined by writing whether the status identification code is still &#34;1&#34; (it was set to that value at the time t2). As the result of this query is negative (the optimistic assumption does not apply, since up to the time t12, SKC has the value &#34;3&#34;), the access administration information of the control field and the SKC are read into processor 1. During this, it is concluded from ZVI that the last access rights for record 007 have been returned and that the value of SKC is 3. At the time t13, an attempt is made to write the control field for 007 with the new optimistic assumption that SKC is still &#34;3&#34;. As it is, ZVI in the control field is set to empty and the status identification code is updated to 0, which means that in response to the next request access rights may be entered without previously reading ZVI. 
     This example shows how (rare) overlapping access operations are being handled. Normally, the access operations of the processors for a record are not overlapping and, since the optimistic assumption applies, the control field does not have to be read according to the invention.