Deadlock detection

A deadlock detection routine is provided to assist with deadlock detection. This routine is a time initiated routine and is activated by the STIMC macro or by the CXFRC macro when the record hold table (RHT) wait queue threshold is reached for a specific RHT entry.

Deadlock detection processing is applied on loosely coupled systems and base-only systems. It consists of taking a snapshot of all of the record hold tables (RHTs) in the complex, merging them into a table, and then running the table through the deadlock detection algorithm.

To have a true event, a cutoff time (the earliest of the time stamps associated with each CPU snapshot of the RHT) determines whether an individual entry of an RHT of a CPU will be merged into the table. If a record is held within the cutoff time, the related RHT entry is merged into the table. Otherwise, the entry is discarded.

When the deadlock detection program is activated, the CPU that has the lowest ordinal number becomes the primary processor. The primary processor merges all of the RHT snapshots that other CPUs sent and performs the deadlock detection routine.

If a deadlock is detected, another deadlock detector ECB is scheduled to run with a CRETC macro. The deadlock user exit (CLUD) is activated on the CPU where the deadlocked ECB is located. The deadlock detection routine takes an action as follows:

  • If the return code from the user exit is 0, the ECB remains deadlocked.
  • If the return code from the user exit is 4, the ECB will be scheduled to exit with dump D9.
  • If the return code from the user exit is 8, the deadlock detection routine sets the CE1SUD and CE1SUG fields of the ECB to CJCSUHRD and CJCSUDLK (that is, X'81').
    The new deadlock detection bit in SUD and SUG is as follows:
    • In MRLNQ, the bit is called:
      CJCSUDLK  EQU   X'01'            DEADLOCK DETECTION
    • In EB0EB, the bit is called:
      CXSGDLK   EQU   X'01'            DEADLOCK DETECTION
    The waiting input/output block (IOB) associated with this ECB is removed from the waiting queue and the postinterrupt routine in the IOB is activated.

You can also use the ZECBL command with the E parameter to remove all the IOBs associated with the deadlocked ECB and force the ECB to exit with dump D9.

SYSTC switch SBDLOCK is defined for deadlock detection processing. You can turn it off using the ZSYSG ALTER command with the NODLOCK parameter.