Method, system, and program for deadlock avoidance
AssigneePhoenix Software International, Inc.
InventorThomas Alan Harper
Life of this patent
Estimating the term…
Abstract
The present disclosure relates to systems, methods, processes, techniques, and computer program products to prevent deadlocks in a mainframe computing system through certain protocols in a lock request, contention exit, and notify exit routines.
Claims18
A method for preventing deadlocks in a mainframe computing system comprising:
- invoking a lock request (LR) routine, by a computer processor, in response to a LR from a requesting transaction, wherein a LR includes a lock has value (LHV), and lock user data (LUD), wherein the LR routine includes determining whether contention exists between the requesting transaction and one or more other transactions;
- invoking a contention exit (CE) routine, by the computer processor, in response to a determination that contention exists;
- wherein the CE routine includes:
- determining, by the computer processor, if the requesting transaction holds other locks;
- in response to an affirmative determination that the requesting transaction holds other locks, determining, by the computer processor, if the LR is a retry request by checking if a retry indicator is set;
- determining, by the computer processor, whether other lock contenders (LC) for the requested lock hold other locks;
- and
- in response to an affirmative determination that the other LCs hold other locks, invoking, by the computer processor, a notify exit (NE) routine on each of the other LCs that hold other locks, wherein the NE routine includes:
- placing a most current LHV for each of the other LCs that hold other locks in a notify exit user data (NEUD) if a transaction for each of the other LCs has a LR that has a same LHV of a LHV of the LR from the requesting transaction, and exiting the NE routine;
- upon exiting the NE routine, invoking, by the computer processor, the CE routine a second time, wherein the CE routine further includes:
- placing, by the computer processor, all LHVs from the NEUD in the LUD of the requesting transaction;
- determining, by the computer processor, if there are more LHVs than can fit in the LUD of the requesting transaction;
- and
- in response to an affirmative determination that there are more LHVs than can fit in the LUD of the requesting transaction, setting an ambiguity indicator in the LUD, denying the LR, and exiting the CE routine;
- and
- upon exiting the CE routine for a second time, completing the LR routine, wherein the LR routine further includes:
- determining, by the computer processor, whether the ambiguity indicator in the LUD is set;
- in response to a determination that the ambiguity indicator in the LUD is not set, determining, by the computer processor, a match between a LHV the requesting transaction owns compared to the LHVs in the LUD of the requesting transaction;
- in response to a determination of a match, turning on the ambiguity indicator in the LUD, rolling back and retrying the transaction from a last syncpoint;
- and
- in response to a determination of no match, setting the retry indicator and reissuing the LR.
A computer program product for preventing deadlocks in a mainframe computing system, the computer program product stored in a computer-readable storage medium, comprising program code that, when executed by the mainframe computing system, causes the computing system to perform actions comprising:
- invoking a lock request (LR) routine, by a computer processor, in response to a LR from a requesting transaction, wherein a LR includes a lock has value (LHV), and lock user data (LUD), wherein the LR routine includes determining whether contention exists between the requesting transaction and one or more other transactions;
- invoking a contention exit (CE) routine, by the computer processor, in response to a determination that contention exists;
- wherein the CE routine includes:
- determining, by the computer processor, if the requesting transaction holds other locks;
- in response to an affirmative determination that the requesting transaction holds other locks, determining, by the computer processor, if the LR is a retry request by checking if a retry indicator is set;
- determining, by the computer processor, whether other lock contenders (LC) for the requested lock hold other locks;
- and
- in response to an affirmative determination that the other LCs hold other locks, invoking, by the computer processor, a notify exit (NE) routine on each of the other LCs that hold other locks, wherein the NE routine includes:
- placing a most current LHV for each of the other LCs that hold other locks in a notify exit user data (NEUD) if a transaction for each of the other LCs has a LR that has a same LHV of a LHV of the LR from the requesting transaction, and exiting the NE routine;
- upon exiting the NE routine, invoking, by the computer processor, the CE routine a second time, wherein the CE routine further includes:
- placing, by the computer processor, all LHVs from the NEUD in the LUD of the requesting transaction;
- determining, by the computer processor, if there are more LHVs than can fit in the LUD of the requesting transaction;
- and
- in response to an affirmative determination that there are more LHVs than can fit in the LUD of the requesting transaction, setting an ambiguity indicator in the LUD, denying the LR, and exiting the CE routine;
- and
- upon exiting the CE routine for a second time, completing the LR routine, wherein the LR routine further includes:
- determining, by the computer processor, whether the ambiguity indicator in the LUD is set;
- in response to a determination that the ambiguity indicator in the LUD is not set, determining, by the computer processor, a match between a LHV the requesting transaction owns compared to the LHVs in the LUD of the requesting transaction;
- in response to a determination of a match, turning on the ambiguity indicator
- in the LUD, rolling back and retrying the transaction from a last syncpoint;
- and
- in response to a determination of no match, setting the retry indicator and reissuing the LR.
A deadlock prevention system comprising:
- one or more processors;
- one or more computer-readable storage media operably coupled to at least one of the processors;
- and
- program instructions stored on the one or more computer-readable storage media for execution by at least one of the processors to cause the deadlock prevention system to perform the actions of:
- invoking a lock request (LR) routine, by at least one of the processors, in response to a LR from a requesting transaction, wherein a LR includes a lock has value (LHV), and lock user data (LUD), wherein the LR routine includes determining whether contention exists between the requesting transaction and one or more other transactions;
- invoking a contention exit (CE) routine, by at least one of the processors, in response to a determination that contention exists;
- wherein the CE routine includes:
- determining, by at least one of the processors, if the requesting transaction holds other locks;
- in response to an affirmative determination that the requesting transaction holds other locks, determining, by at least one of the processors, if the LR is a retry request by checking if a retry indicator is set;
- determining, by at least one of the processors, whether other lock contenders (LC) for the requested lock hold other locks;
- and
- in response to an affirmative determination that the other LCs hold other locks, invoking, by at least one of the processors, a notify exit (NE) routine on each of the other LCs that hold other locks, wherein the NE routine includes:
- placing a most current LHV for each of the other LCs that hold other locks in a notify exit user data (NEUD) if a transaction for each of the other LCs has a LR that has a same LHV of a LHV of the LR from the requesting transaction, and exiting the NE routine;
- upon exiting the NE routine, invoking, by at least one of the processors, the CE routine a second time, wherein the CE routine further includes:
- placing, by at least one of the processors, all LHVs from the NEUD in the LUD of the requesting transaction;
- determining, by at least one of the processors, if there are more LHVs than can fit in the LUD of the requesting transaction;
- and
- in response to an affirmative determination that there are more LHVs than can fit in the LUD of the requesting transaction, setting an ambiguity indicator in the LUD, denying the LR, and exiting the CE routine;
- and
- upon exiting the CE routine for a second time, completing the LR routine, wherein the LR routine further includes:
- determining, by at least one of the processors, whether the ambiguity indicator in the LUD is set;
- in response to a determination that the ambiguity indicator in the LUD is not set, determining, by at least one of the processors, a match between a LHV the requesting transaction owns compared to the LHVs in the LUD of the requesting transaction;
- in response to a determination of a match, turning on the ambiguity indicator in the LUD, rolling back and retrying the transaction from a last syncpoint;
- and
- in response to a determination of no match, setting the retry indicator and reissuing the LR.
Dependencies are inferred from the claim text.