Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Net 26

CBSE NET JUNE 2013 PAPER III


Q. An operating system using banker’s algorithm for deadlock avoidance has ten dedicated devices (of same type) and has three processes P1, P2 and P3 with maximum resource requirements of 4, 5 and 8 respectively.
There are two states of allocation of devices as follows :
State 1 Processes P1 P2 P3, devices allocated 2 3 4
State 2 Processes P1 P2 P3, devices allocated 0 2 4
Which of the following is correct ?


(A) State 1 is unsafe and state 2 is safe.
(B) State 1 is safe and state 2 is unsafe.
(C) Both, state 1 and state 2 are safe.
(D) Both, state 1 and state 2 are unsafe.


Ans:- A


Explanation:-
STATE 1:
MAXIMUM NEEDS
CURRENT NEEDS
P1
4
2
P2
5
3
P3
8
4
TOTAL NUMBER OF DEVICES = 10
NUMBER OF FREE DEVICES = Total number of devices – current needs of devices = 10 – 9 = 1.
Note: Current needs shows number of devices engaged.
Since the number of free device is just 1, it can be allocated to any of the processes p1,p2 or p3.
p1 requires device = Max needs – Current needs = 4 – 2 = 2,
p2 requires device= Max needs – Current needs = 5 – 3 = 2,
p3 requires device= Max needs – Current needs = 8 – 4 = 4,
Since, none of the processes requirement can be satisfied, the state 1 is in unsafe state.
STATE 2:
MAXIMUM NEEDS
CURRENT NEEDS
P1
4
0
P2
5
2
P3
8
4
TOTAL NUMBER OF DEVICES = 10
NUMBER OF FREE DEVICES= Total devices – current needs of devices = 10 – 6 = 4
p1 requires device = Max needs – Current needs = 4 – 0 = 4,
Because the number of free device right now is 4 and p1 gets its maximum need, it completes the process and returns all of the 4 devices.
p2 requires device = Max needs – Current needs = 5 – 2 = 3,
3 devices, which can be allocated right now. p2 completes its process and returns all the 3 devices.
p3 requires device = Max needs – Current needs = 8 – 4 = 4,
4 devices. which can be allocated right now. So, p3 also can finish its execution successfully.
So, state 2 is in safe state.
So, the correct answer is A , in which state 1 is in unsafe state and state 2 is in safe state

Leave a Comment