Re: Dead locking Information

Discussion created by ca.portal.admin on Oct 17, 2005
I am not sure that I would agree that most deadlocks occur
because of ADS/O retrieval locking. I would suggest that Bill analyze
the CV logs to find determine which programs are deadlocking the most
and on what records. A point to remember about the dbkey in the log, is
that the dbkey reported in the log is in horizontal hex format
(ppppppll, page and line, assuming a radix of 8).

Then after proper analysis, attention can be paid to the
programs involved. One area that usually causes a lot of problems are
OOAK records, where a next key is retrieved. We eliminated most of the
deadlocks on these types of records by using a small sub-program as a
separate run-unit, that did an OBTAIN KEEP EXCLUSIVE, updated the
record, FINISHED, and returned the next key to the caller. Another
deadlock avoidance methodology would be to at retry logic to troublesome
programs (remember that currencies must be restored and the run unit
rebound and readied).

Here some other pointers:

Situations which Encourage Deadlocks
1. Holding many resources
a. Batch programs without commit logic
b. Online ""hogs""

2. Holding resources too long
a. Conversational programs
b. I/O Intensive applications

3. Holding scarce resources
a. OOAK (One of a Kind) Records
b. FOAK (Few of a Kind) Records
c. Holding Resources Unnecessarily
d. Unnecessary IDMS calls

Avoiding Deadlocks

1. In batch programs, use commit logic as instructed.

2. In online programs:

a. Code efficiently as possible.
b. Avoid conversational mode (applicable only for DC COBOL).
c. Minimize I/O by saving data in working storage or at least
save DBKey's.
d. Don't use Entry Point records and walk long sets (use CALC or
INDEX keys if possible).
e. Do update towards end of program (records won't be held as long).
f. Don't do unnecessary OBTAINS when FINDs will do.
g. Don't do FIND CURRENT if you don't have to -- learn how currency
h. Walk sets intelligently! If the data is most likely at the end
of the set, walk the set backwards using OBTAIN PRIOR.

Dan Miley
Lockeed Martin