操作系统课程2.4_3_死锁的处理策略—避免死锁
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Requesti[j]≤Available[j] (0≤j≤m)
”①
Pi
Available = Available - Requesti; Allocation[i, j] = Allocation[i, j] + Requesti[j]; Need[i, j] = Need[i, j] – Requesti[j]
④
①
④
①
m n*m Max
Available ①
n*m Allocation
Max – Allocation = Need
m
Request
③ ①
”
① ①
Allocation
(57, 34, 23) (1, 2, 2) (6, 0, 0) (0, 1, 1) (4, 3, 1)
Need
①
③
④ ① Pi “
①
m n*m Max
Available ①
n*m Allocation
Max – Allocation = Need
m
Request
③ ①
”
① ①
① ①
(0, 1, 0) (2, 0, 0) (3, 0, 2) (2, 1, 1) (0, 0, 2)
(7, 4, 3) (1, 2, 2) (6, 0, 0) (0, 1, 1) (4, 3, 1)
3, 3, 2
④ P1 P3
④
P1 P3
(2, 0, 0) + (2, 1, 1) + (3, 3, 2) = (7, 4, 3)
P0 P2 P4
④
5
① ①
(10, 5, 7)
① P1 P3
① (37, 34, 23)
①
P0 (8, 5, 3) P1 (3, 2, 2) P2 (9, 5 ,2) P3 (2, 2, 2) P4 (4, 3, 6)
(0, 1, 0) (2, 0, 0) (3, 0, 2) (2, 1, 1) (0, 0, 2)
(7, 4, 3) (1, 2, 2) (6, 0, 0) (0, 1, 1) (4, 3, 1)
① > (53, 3, 2) < (3, 3, 2) > (5, 3, 2) < (5, 3, 2)
④P1 ④P3 ……
… {P1} P3} P0 P2 P4}
① (3, 3, 2)
④
P1
①
① (5, 3, 2)
(10, 5, 7)
① P1 P3
① (37, 34, 23)
n
Max Rj
Need
n*m ①
Max[i, j]=K
①
Pi
①
Requesti
m① ①
Pi n*m
K① Allocation
Max – Allocation =
①
m
Available
①
m ①
Requesti[j]≤Need[i, j] (0≤j≤m)
④
P3
①
① (7, 4, 3)
④
5
(10, 5, 7)
① (357, 34, 23)
wenku.baidu.com
①
P1
P1
P1 ①
①
①
P3
(2,P03, 0) + (3, 3, 2) = (5, 3, 2)
P3
①
①
(2, 1, 1) + (5, 3, 2) = (7, 4, 3)
(5, 3, 2)
(7, 4, 3) ……
P0 (7, 5, 3) P1 (3, 2, 2) P2 (9, 0 ,2) P3 (2, 2, 2) P4 (4, 3, 3)
B
70
A
40
T
50
②
20
50
10
30
30
20
(7, 2, 5)
(3, 3, 2)
①
① —— ①
5 (10, 5, 7)
P0~P4 3
P0 (7, 5, 3) P1 (3, 2, 2) P2 (9, 0 ,2) P3 (2, 2, 2) P4 (4, 3, 3)
(0, 1, 0) (2, 0, 0) (3, 0, 2) (2, 1, 1) (0, 0, 2)
Available = (13, 23, 12)
Request0 = (2, 1, 1)
P0 (7, 5, 3) P1 (3, 2, 2) P2 (9, 0 ,2) P3 (2, 2, 2) P4 (4, 3, 3)
Max
(02, 12, 01) (2, 0, 0) (3, 0, 2) (2, 1, 1) (0, 0, 2)
(7, 4, 3) (1, 2, 2) (6, 0, 0) (0, 1, 1) (4, 3, 1)
P0 (7, 5, 3) P1 (3, 2, 2) P2 (9, 0 ,2) P3 (2, 2, 2) P4 (4, 3, 3)
(0, 1, 0) (2, 0, 0) (3, 0, 2) (2, 1, 1) (0, 0, 2)
A
40
T
50
B
70
A
40
T
50
”100 B
70 … 40 … 50 …
①…
A
T
20 10 30 … ②
20
50
10
30
30
20
②
20 10+20=30
30
50 30-20=10
20
BAT
…
40
…A
20
A
……
TàBàA
AàTàB
OK OK
20
A 20 A 10 … A 20+30 = 50TàBàA ATà20TàB T
(8, 4, 3) (1, 2, 2) (6, 5, 0) (0, 1, 1) (4, 3, 4)
3, 3, 2
④ P1 P3
④
P1 P3
(2, 0, 0) + (2, 1, 1) + (3, 3, 2) = (7, 4, 3)
P0 (8, 4, 3) P2 (6, 5, 0) P4 ④
① (4, 3, 4)
A
40
T
50
B
70
A
40
T
50
”100 B
70 … 40 … 50 …
①…
A
T
20 10 30 … ②
20
50
10
30
30
20
②
20 10+20=30
30
50 30-20=10
20
BAT
…
40
…A
20
A
……
TàBàA
OK
20
20 50+20=70
TT 20+30=50 BB
A
B A T
…
BAT
B
70
50+30 = 80
… B…
②
B
70
20+30=60 50-30=20
A
40
10
30
T
50
30
20
②
B
70
20
50
A
40
10+20=30 30-20=10
T
50
30
20
B 30 BAT
…
20 ④…
10
A 20
①
TàBàA
① ①
” ①
A
10
TàB àA
①
①
Dijkstra ④
①
BAT ①
① R0~R2
——
B A T
…
BAT
B
70
A
40
T
50
B
70
A
40
T
50
”100 B
70 … 40 … 50 …
①…
A
T
20 10 30 … ②
20
50
10
30
30
20
②
20+30=50 10 30
50-30=20 30 20
BAT
…
40
…B
30
B
……
10 20
B 30
10 BAT ④……
B A T
…
BAT
B
70