Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
---------------------
7 9 7 10
Available
If,
Need
< Available then, Work = Available + (Allocation)i
P0 (3 3 0 0) < (3 4 2 2)
.. Work: (3 4 2 2) + (0 0 1 2) =
P3 (1 0 1 2) < (3 4 3 4)
.. Work: (3 4 3 4) + (1 3 1 2) =
P4 (2 1 3 3) < (4 7 4 6)
.. Work: (4 7 4 6) + (1 4 3 2) =
P1 (1 1 3 1) < (5 11 7 8)
.. Work: (5 11 7 8) + (3 1 2 1) =
P2 (1 3 1 3) < (8 12 9 9)
.. Work: (8 12 9 9) + (2 1 0 3) =
.. Sequence is: P0 -> P3 -> P4 -> P1 -> P2
3
4
5
8
10
4
7
11
12
13
3
4
7
9
9
4
6
8
9
12
d) If a request from process P1 arrives for (1, 1, 0, 1), what will be the systems state?
Answer:
Request: P1 (1 1 0 1)
.. (Allocation) P1
= (Allocation) P1 + (Request) P1
= (3 1 2 1) + (1 1 0 1)
=4 2 2 2
& (Available)
P0
P1
P2
P3
P4
= (Available) (Request)P1
= (3 4 2 2) (1 1 0 1)
= 2 3 2 1
Allocation
A BCD
Max
A BCD
Need
A B CD
0
4
2
1
1
3
4
3
2
3
3
0
1
1
2
0
2
1
3
4
1
2
0
1
3
2
2
3
2
2
3
2
4
3
5
1
5
1
2
6
2
2
6
4
5
3
0
3
0
1
0
3
1
1
3
0
0
3
2
3
Here, no need is less than available. So, The Request P1(1, 1, 0,1) is Not Granted.
Available : 1
1 1
Answer:
R1P2:
P1R1:
R4P1:
P2R4:
R4P3:
R2P3:
P3R3:
R2P4:
R3P4:
Set: 02
Class Test Number: 02
1. Consider the following snapshot of a system: A, B, C & D have 3, 17, 16 & 12 instances.
Allocation
Max
A B C D
A B C D
P0
0 1 1 0
0 2 1 0
P1
1 2 3 1
1 6 5 2
P2
1 3 6 5
2 3 6 6
P3
0 6 3 2
0 6 5 2
P4
0 0 1 4
0 6 5 6
a) What is the content of the matrix Available?
Answer:
A B C D
Total
3
17 16 12
Allocated
2
12 14 12
( - ) -------------------------------------------------
Available
1
1
1
2
3
6
12
12
14
17
3
6
7
10
16
0
2
6
7
12
d) If a request from process P1 arrives for (0,2,1,0), what will be the systems state?
Answer:
Request: P1 (0 2 1 0)
.. (Allocation) P1
= (1 2 3 1) + (0 2 1 0)
= 1 4 4 1
& (Available)
P0
P1
P2
P3
P4
Allocation
A B C D
0 1 1 0
1 4 4 1
1 3 6 5
0 6 3 2
0 0 1 4
= (1 5 2 0) (0 2 1 0)
= 1 3 1 0
Need
A B C
0 1 0
0 2 2
1 0 0
0 0 2
0 6 4
D
0
1
1
0
2
P0 (0 1 0 0) < (1 3 1 0) .. Work: (1
P3 (0 0 2 0) < (1 4 2 0) .. Work: (1
P4 (2 1 3 3) < (1 10 5 2) .. Work: (1
P1 (0 2 2 1) < (1 10 6 6) .. Work: (1
P2 (1 0 0 1) < (2 14 10 7)
.. Work: (2
.. Sequence is: P0 -> P3 -> P4 -> P1 -> P2
3
4
10
10
14
1
2
5
6
10
0)
0)
2)
6)
7)
+
+
+
+
+
(0
(0
(0
(1
(1
1
6
0
4
3
1
3
1
4
6
0)
2)
4)
1)
5)
=
=
=
=
=
1
1
1
2
3
4
10
10
14
17
2
5
6
10
16
0
2
6
7
12
1. Consider the following snapshot of a system: A, B and C have 10, 2, and 5 instances.
Allocation
Need
ABC
ABC
P0
101
210
P1
212
333
P2
300
101
P3
101
010
a) What is the content of the matrix Available?
Answer:
A B C
Total
: 10 2 5
Allocated : 7 1 4
(-) ----------------------------
Available :
1 1
Answer:
P1R1:
R1P2:
P2R4:
R4P1:
R4P3:
P3R3:
R3P4:
R2P3:
R2P4: