MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how can a programmer avoid deadlocks in cics ?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> CICS and Middleware
View previous topic :: View next topic  
Author Message
star99
Beginner


Joined: 09 Mar 2004
Posts: 4
Topics: 2

PostPosted: Tue Mar 09, 2004 2:30 pm    Post subject: how can a programmer avoid deadlocks in cics ? Reply with quote

is it his/her responsibility ?
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Tue Mar 09, 2004 3:13 pm    Post subject: Reply with quote

Star99,

I can say to some extent it is indeed the programmer's responsibility to avoid dead locks. First take a look as to why the dead lock has occured in the first place. once you know the reason/culprit , then it is a simple task of how to handle the deadlock. If the transaction is not that critical , code a delay in the pgm and try the update after the delay. If this task is indeed critical , then you need to check with the other task and see if then can implement the delay logic. If you are dealing with DB2 the check the isolation level defined.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
star99
Beginner


Joined: 09 Mar 2004
Posts: 4
Topics: 2

PostPosted: Tue Mar 09, 2004 4:56 pm    Post subject: Reply with quote

sorry, but i wondered how can the programmer avoid dead locks before it happens ?
Back to top
View user's profile Send private message Send e-mail
R.Nickel
Beginner


Joined: 02 Dec 2002
Posts: 22
Topics: 0
Location: Sydney, Australia

PostPosted: Tue Mar 09, 2004 10:39 pm    Post subject: Reply with quote

Deadlocks occur because 2 programs are updating 2 or more databases, if program PGM1 updates DB1 and DB2 in that order and program PGM2 updates DB2 then DB1 then you have a potential for a Deadlock. ensuring that this does not happen will ensure that you have no deadlocks and the subsequent deadlock ABEND
_________________
Rainer
Back to top
View user's profile Send private message
Mike Chantrey
Intermediate


Joined: 10 Sep 2003
Posts: 234
Topics: 1
Location: Wansford

PostPosted: Mon Mar 15, 2004 8:32 am    Post subject: Reply with quote

To expand/generalize the above comment, the general principle for avoiding deadlocks is:
"All programs which update more than one recoverable resource should update in the same order."

Why? If program A updates item X then Y, and program B updates Y then X, you can get a situation where A holds X and needs Y, and B holds Y but needs X. Neither can proceed - deadlock occurs.
This cannot occur if they both update X then Y.

Thje recoverable resources could be records on the same file/table or different files/tables. Applies to VSAM, DB2 whatever.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> CICS and Middleware All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group