Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 11 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
11
Dung lượng
157 KB
Nội dung
Wait-die
Transactions given a timestamp when they
arrive …. ts(Ti)
Ti can only wait for Tj if ts(Ti)< ts(Tj)
else die
T1
(ts =10)
T2
(ts =20)
T3
(ts =25)
Wait for A
Wait for C?
Wait fo B
T1
(ts =22)
T2
(ts =20)
T3
(ts =25)
wait(A)
requests A: wait for T
2
or T
3
or both?
(in my html notes, I assume both)
Note: ts between
20 and 25.
Wait-die-1
T1
(ts =22)
T2
(ts =20)
T3
(ts =25)
wait(A)
wait(A)
One option: T
1
waits just for T
3
, transaction holding lock.
wait(A)
But when T
2
gets lock, T
1
will have to die! (also lots of WFG revision)
Wait-die-1
T1
(ts =22)
T2
(ts =20)
T3
(ts =25)
wait(A)
wait(A)
wait(A)
Another option: T
1
waits for both T
2
, T
3
E.g., (saves having to revise WFG) T
1
allowed to wait iff there is at
least one younger trans wait-involved with A.
But again, when T2 gets lock, T
1
must die!
Wait-die-2
T1
(ts =22)
T2
(ts =20)
T3
(ts =25)
wait(A)
Yet another option: T
1
preempts T
2
(T
2
is just waiting idly anyway), so T
1
only
waits for T
3
; T
2
then waits for T
3
But, T
2
may starve? And lots of WFG
work for Deadlock Mgr (shifting edges)
wait-A
Wait-die-3
Wound-wait
Transactions given a timestamp when they
arrive … ts(Ti)
Ti wounds Tj if ts(Ti)< ts(Tj)
else Ti waits
“Wound”: Tj rolls back (if it cannot finish in
small interval of time) and gives lock to Ti
T1
(ts =25)
T2
(ts =20)
T3
(ts =10)
Wait A
Wait B
Wait C
Wound-wait
T1
(ts =15)
T2
(ts =20)
T3
(ts =10)
wait(A)
requests A: wait for T
2
or T
3
?
Note: ts between
10 and 20.
Wound-wait-2
T1
(ts =15)
T2
(ts =20)
T3
(ts =10)
wait(A)
wait(A)
One option: T
1
waits just for T
3
, transaction holding lock.
But when T
2
gets lock, T
1
waits for T
2
and wounds T
2
.
Wound-wait-2
Wait A
T1
(ts =15)
T2
(ts =20)
T3
(ts =10)
wait(A)
wait(A)
wait(A)
Another option:
T
1
waits for both T
2
, T
3
⇒ T
2
wounded right away!
Wound-wait-3