首页 > 试题广场 >

Consider the following snapsho

[问答题]

Consider the following snapshot of a system :

Resources

Processes

Allocation

A  B  C  D

Max Need

A  B  C  D

Available

A  B  C  D

P0

P1

P2

P3

P4

0 0  1  2

1 0  0  0

1  3  5  4

0  6  3  2

0  0  1  4

0  0  1  2

1  7  5  0

2  3  5  6

0  6  5  2

0  6  5  6

1  5  2  0

Answer the following questions using the banker’s algorithm:

(1) What is the content of the matrix Need?

(2) Is the system in safe state? Why?
(3)If a request from process P1 arrives for (0,4,2,0), can the request be granted (允许) immediately?

(1) = MAX Need -Allocation

(2) 此时系统状态是不安全的。因为:

不存在使所有进程都顺序执行的序列。

A = (1 5 2 0)

P0  marked     A = (1 5 2 0)

P3  marked     A = (1 5 4 0)

进程执行顺序: P0 P3 ,但是剩余资源不能满足其他进程的需求

(3) 允许。因为

存在使进程都顺序执行的序列: P0 P3 P1 P2 P4

A = (1 5 2 0)

P0  marked     A = (1 5 2 0)

P3  marked     A = (1 5 4 0)

P1  marked     A = (1 8 7 0)

P2  marked     A = (2 8 7 2)

P4  marked     A = (2 14 11 4)

发表于 2017-05-17 01:17:36 回复(0)