Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Which transaction should I abort in a deadlock?  RSS feed

azuki ooh
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose the transactions above were executed using two-phase locking and have reached the following deadlock state:
1 Transaction T1: start
2 Transaction T2: start
3 Transaction T3: start
4 Transaction T4: start
5 Transaction T1: read(A)
6 Transaction T1: read(B)
7 Transaction T1: read(C)
8 Transaction T1: read(D)
9 Transaction T2: read(E)
10 Transaction T2: write(E)
11 Transaction T2: read(A)
12 Transaction T3: read(F)
13 Transaction T3: write(F)
14 TransactionT3: read(B)
15 Transaction T4: read(D)

(a) T2
(b) T3
(c) T1
(d) T4

I'm thinking it should be T1. Because at Line 9, T2 waits E as it has been locked by T1.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!