Posted by : Anonymous Sunday, 13 January 2013


uestion 1: [Marks 10]
Let us suppose that there are five processes P1, P2, P3, P4 and P5 and three resources Printer, scanner and
photocopier. Let us suppose that there are 25 instances of resource type Printer, 18 instances of resource type
scanner and 21 instances of resource type photocopier. Let us consider that at time T= 0, system has the
following state.
Max
Printer scanner photocopier
P1  10 8 6
P2  6 5 5
P3  12 3 5
P4  5 5 5
P5  7 6 6
Allocation
Printer scanner photocopier
P1  3 4 3
P2  5 3 3
P3  6 3 5
P4  5 4 4
P5  3 3 5
Available
Printer scanner photocopier
P1  3 1 1
P2
P3
P4
P5
Use safety algorithm (which is invoked by banker’s algorithm) and write down all the intermediate steps to find
out that either the system is in safe state or not.If system is in safe state then write down the safe sequence and if
system is not in safe state then give reason to support your answer.
Note: Write down all the intermediate steps during finding out the safe sequence. If you will not write down the
intermediate steps and if you will just write only the safe sequence then you will get zero marks.
Question 2: [Marks 10]
Let us suppose that there are five processes P1, P2, P3, P4 and P5 and three resources Printer, scanner and
photocopier. Let us suppose that there are 24 instances of resource type Printer, 18 instances of resource type
scanner and 21 instances of resource type photocopier. Let us consider that at time T= 0, system has the
following state.
Max
Printer scanner photocopier
P1  10 8 6
P2  6 5 5
P3  12 3 5
P4  5 5 5
P5  7 6 6
Allocation
Printer scanner photocopier
P1  3 4 3
P2  5 3 3
P3  6 3 5
P4  5 4 4
P5  3 3 5
Available
Printer scanner photocopier
P1  2 1 1
P2
P3
P4
P5
Use safety algorithm (which is invoked by banker’s algorithm) and write down all the intermediate steps to find
out that either the system is in safe state or not.If system is in safe state then write down the safe sequence and if
system is not in safe state then give reason to support your answer.
Solution:
Use Table Format for Submit this Assignment.

 Answer no.1


Allocation
Need

Work
P1
3
4
3
7
4
3
3
1
1
P2
5
3
3
1
2
2
8
5
5
P3
6
3
5
6
0
0



P4
5
4
4
0
1
1



P5
3
3
5
4
3
1



P4



Allocation
Need

Work
P1
3
4
3
7
4
3
3
1
1
P2
5
3
3
1
2
2
8
5
5
P3
6
3
5
6
0
0
11
9
8
P4
5
4
4
0
1
1



P5
3
3
5
4
3
1



P4, P1



Allocation
Need

Work
P1
3
4
3
7
4
3
3
1
1
P2
5
3
3
1
2
2
8
5
5
P3
6
3
5
6
0
0
11
9
8
P4
5
4
4
0
1
1
16
12
11
P5
3
3
5
4
3
1



P4, P1, P2



Allocation
Need

Work
P1
3
4
3
7
4
3
3
1
1
P2
5
3
3
1
2
2
8
5
5
P3
6
3
5
6
0
0
11
9
8
P4
5
4
4
0
1
1
16
12
11
P5
3
3
5
4
3
1
22
15
16
P4, P1, P2, P3, P5

Answer no.2



Allocation
Need

Work
P1
3
4
3
7
4
3
2
1
1
P2
5
3
3
1
2
2
7
5
5
P3
6
3
5
6
0
0



P4
5
4
4
0
1
1



P5
3
3
5
4
3
1



P4



Allocation
Need

Work
P1
3
4
3
7
4
3
2
1
1
P2
5
3
3
1
2
2
7
5
5
P3
6
3
5
6
0
0
12
8
8
P4
5
4
4
0
1
1



P5
3
3
5
4
3
1



P4, P2



Allocation
Need

Work
P1
3
4
3
7
4
3
2
1
1
P2
5
3
3
1
2
2
7
5
5
P3
6
3
5
6
0
0
12
8
8
P4
5
4
4
0
1
1
15
11
12
P5
3
3
5
4
3
1



P4, P2, P5



Allocation
Need

Work
P1
3
4
3
7
4
3
2
1
1
P2
5
3
3
1
2
2
7
5
5
P3
6
3
5
6
0
0
12
8
8
P4
5
4
4
0
1
1
15
11
12
P5
3
3
5
4
3
1
21
14
17
P4, P2, P5, P3, P1


Safety Alogrithm Sequence:
Answer No.1 : P4, P1, P2, P3, P5
 Answer No.2:  P4, P2, P5, P3, P1

Leave a Reply

Subscribe to Posts | Subscribe to Comments

- Copyright © virtual university of pakistan - Skyblue - Powered by Blogger - Designed by Johanes Djogan -