![](images/graphics/blank.gif)
Deadlocks
lượt xem 3
download
![](https://tailieu.vn/static/b2013az/templates/version1/default/images/down16x21.png)
Transactions given a timestamp when they arrive … ts(Ti) Ti wounds Tj if ts(Ti)
Bình luận(0) Đăng nhập để gửi bình luận!
Nội dung Text: Deadlocks
- Waitdie Transactions given a timestamp when they arrive …. ts(Ti) Ti can only wait for Tj if ts(Ti)
- Waitdie1 T1 requests A: wait for T2 or T3 or both? (in my html notes, I assume both) (ts =22) T2 Note: ts between 20 and 25. (ts =20) wait(A) T3 (ts =25)
- Waitdie1 One option: T1 waits just for T3, transaction holding lock. But when T2 gets lock, T1 will have to die! (also lots of WFG revision) T1 (ts =22) wait(A) T2 wait(A) (ts =20) wait(A) T 3 (ts =25)
- Waitdie2 Another option: T1 waits for both T2, T3 E.g., (saves having to revise WFG) T1 allowed to wait iff there is at least one younger trans waitinvolved with A. But again, when T2 gets lock, T1 must die! T1 (ts =22) wait(A) T2 wait(A) (ts =20) wait(A) T 3 (ts =25)
- Waitdie3 Yet another option: T1 preempts T2 (T2 is just waiting idly anyway), so T1 only waits for T3; T2 then waits for T3 But, T2 may starve? And lots of WFG work for Deadlock Mgr (shifting edges) T1 (ts =22) waitA T2 wait(A) (ts =20) T3 (ts =25)
- Woundwait Transactions given a timestamp when they arrive … ts(Ti) Ti wounds Tj if ts(Ti)
- Woundwait T1 (ts =25) Wait A T2 Wait C (ts =20) Wait B T3 (ts =10)
- Woundwait2 T1 requests A: wait for T2 or T3? (ts =15) T2 Note: ts between 10 and 20. (ts =20) wait(A) T3 (ts =10)
- Woundwait2 One option: T1 waits just for T3, transaction holding lock. But when T2 gets lock, T1 waits for T2 and wounds T2. T1 Wait A (ts =15) T2 wait(A) (ts =20) wait(A) T3 (ts =10)
- Woundwait3 Another option: T1 waits for both T2, T3 ⇒ T2 wounded right away! T1 (ts =15) wait(A) T2 wait(A) (ts =20) wait(A) T3 (ts =10)
- Woundwait4 Yet another option: T1 preempts T2, so T1 only waits for T3; T2 then waits for T3 and T1... ⇒ T2 is spared! Lots of WFG work for Deadlock Mgr (shifting edges) and T2 may starve. T1 (ts =15) waitA T2 wait(A) (ts =20) T3 (ts =10)
- User/Program commands Lots of variations, but in general Begin_work Commit_work Abort_work
- Nested transactions User program: ... Begin_work; ... ... If results_ok, then commit work else abort_work
- Nested transactions User program: ... Begin_work; Begin_work; ... If results_ok, then commit work else {abort_work; try something else…} ... If results_ok, then commit work else abort_work
- Parallel Nested Transactions T1: beginwork ... parallel: T11: begin_work T1 ... T1 commit_work T11 T12 T12: begin_work ... commit_work ... commit_work
- Locking Locking What are we really locking?
- Example: Ti ... Read record r1 ... Read record r1 do record locking ... Modify record r3 ...
- But underneath: If we lock all record id data involved in read R1 of R1, we may prevent R2 an update to R2 (which may require reorganization within R3 block) Disk pages
- Solution: view DB at two levels Top level: record actions record locks undo/redo actions — logical e.g., Insert record(X,Y,Z) Redo: insert(X,Y,Z) Undo: delete
- Low level: deal with physical details latch page during action (release at end of action)
![](images/graphics/blank.gif)
CÓ THỂ BẠN MUỐN DOWNLOAD
-
Bế tắc (Deadlock)
11 p |
714 |
47
-
Bài giảng Deadlock
56 p |
248 |
33
-
Bài giảng Hệ điều hành - Chương 5: Deadlock
36 p |
185 |
24
-
Bài giảng Hệ điều hành: Chương 4 - Deadlock
48 p |
333 |
24
-
Bài giảng Hệ điều hành: Chương 6 - ThS. Hà Lê Hoài Thương
45 p |
160 |
20
-
Chương 6: Deadlocks
42 p |
114 |
12
-
Bài giảng Hệ điều hành - Chương 3: Deadlock (Lương Minh Huấn)
62 p |
88 |
12
-
Bài giảng Hệ điều hành: Chương 4 - ĐH Bách khoa TP HCM
22 p |
94 |
12
-
Lecture Operating System: Chapter 03 - University of Technology
29 p |
89 |
7
-
Bài giảng Hệ điều hành: Chương 6.2 - ThS. Phan Đình Duy
34 p |
86 |
6
-
Bài giảng Hệ điều hành: Chương 6 - ThS. Hà Lê Hoài Trung
52 p |
69 |
6
-
Bài giảng Hệ điều hành: Chapter 6.1 - ThS. Trần Thị Như Nguyệt
30 p |
42 |
5
-
Bài giảng Hệ điều hành: Chapter 6.2 - ThS. Trần Thị Như Nguyệt
33 p |
68 |
5
-
Bài giảng Hệ điều hành: Chương 6.2 - ĐH Công nghệ thông tin
34 p |
66 |
4
-
Bài giảng Hệ điều hành: Chương 6.1 - ThS. Phan Đình Duy
28 p |
57 |
4
-
Chapter 5: Deadlock
50 p |
74 |
4
-
Bài giảng Hệ điều hành: Chương 6.1 - ĐH Công nghệ thông tin
28 p |
49 |
3
-
Bài giảng Hệ quản trị cơ sở dữ liệu: Deadlock
28 p |
31 |
3
![](images/icons/closefanbox.gif)
![](images/icons/closefanbox.gif)
Chịu trách nhiệm nội dung:
Nguyễn Công Hà - Giám đốc Công ty TNHH TÀI LIỆU TRỰC TUYẾN VI NA
LIÊN HỆ
Địa chỉ: P402, 54A Nơ Trang Long, Phường 14, Q.Bình Thạnh, TP.HCM
Hotline: 093 303 0098
Email: support@tailieu.vn
![](https://tailieu.vn/static/b2013az/templates/version1/default/js/fancybox2/source/ajax_loader.gif)