aspose file tools*
The moose likes Threads and Synchronization and the fly likes Which transaction should I abort in a deadlock? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Which transaction should I abort in a deadlock?" Watch "Which transaction should I abort in a deadlock?" New topic
Author

Which transaction should I abort in a deadlock?

azuki ooh
Greenhorn

Joined: Nov 07, 2008
Posts: 20
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Which transaction should I abort in a deadlock?