Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Questions regarding transaction executions

$
0
0
I have started learning about databases and SQL, and recently studied about transactions, including deadlocks, shared (S) locks, exclusive (X) locks, wait-die protocol and wound-wait protocol. The point is that I somehow understand the theory behind those things, but when I have a transaction example as below, I'm having difficulties in understanding where it causes a deadlock and how it can be solved using wait-die and wound-wait protocols.

If someone can give me the detailed answers of the following questions regarding the transaction execution given below I would be glad.

Questions:

1) When and why deadlock happens?
2) How it can be handled using wait-die protocol?
3) How it can be handled using wound-wait protocol?


    T3             T4
---------------------------
lock-X(B)/>/>   |
read(B)/>/>     |
B := B - 50 |
write(B)/>/>    |
            | lock-S(A)
            | read(A)
            | lock-S(B)/>/>
lock-X(A)   |



P.S I cannot delete those "/>", if someone can edit and delete them, I would be glad.

Viewing all articles
Browse latest Browse all 51036

Trending Articles