ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > ZSTU class(2019-2020-1) > student directories > 2017331200153-梁庆龙 >
homework5 Version 0
👤 Author: by 1589080613qqcom 2019-12-02 15:27:53
In the method of avoiding deadlock, the limited condition is weak, and it is possible to obtain satisfactory system performance. In this method, the system state is divided into safe state and unsafe state. As long as the system is always in safe state, deadlock can be avoided.

Here is my demo:

R = (17    5   20)        V = (2    2   3)

Allocation   |   Max             |    Available

A    B    C         A    B    C          A    B    C

P0      2     1     2         5     5     9         2     3     3

P1      4     0     2        5     3     6

P2      4     0     5         4    0     11

P3      2     0     4         4    2     5

P4      3     1     4         4    2     4

Need

A    B    C

P0      3     4     7

P1      1     3     4

P2      0    0    6

P3      2    2     1

P4      1     1     0

We claim that the system is currently in a safe state. Indeed, the sequence <p4,p3,p2,p1,p0> satisfies the safety criteria.

V (2    2    3)  > Need(p4)

V'(5    4     7)  > Need(p3)

V''(7    4     11)  > Need(p2)

V'''(11   4    16)  > Need(p1)

V''''(15   4    18)  > Need(p0)

Suppose now that process P1 requests three additional instance of resource type B and four instances of  resource type C, so Request1=(0   3   2). Since Request1 < V(2  2  3) and Request1 < Need(p1), this request will be fulfilled.

Now, we can arrive at the following new state:

Allocation   |   Need            |    Available

A    B    C         A    B    C          A    B    C

P0      2     1     2       3     4     7          2     0     1

P1      4     3     4       0   0     2

P2      4     0     5       0    0    6

P3      2     0     4       2    2     1

P4      3     1     4        1     1     0

Please login to reply. Login

Reversion History

Loading...
No reversions found.