Computer Sciences > Gate 2017 Set-2 > Deadlock
A system shares 9 tape drives. The current allocation and maximum requirement of tape drives for 3 processes are shown below:

Process Allocation Time Maximum Requirement
P1 3 7
P2 1 6
P3 3 5

Which of the following best describes the current state of the system?
A
Safe, Deadlocked
B
Safe, Not Deadlocked
C
Not Safe, Deadlocked
D
Not Safe, Not Deadlocked

Correct : D

Given:
Total number of tape drives = 9
Processes: P1, P2, P3
Allocation: P1 = 3, P2 = 1, P3 = 3
Max Requirement: P1 = 7, P2 = 6, P3 = 5
To find:
Whether the current state of the system is Safe/Not Safe and Deadlocked/Not Deadlocked.
Solution:
First, let me calculate the total allocated tape drives.
Total allocated = 3 + 1 + 3 = 7
Now let me find the currently available tape drives.
Available = Total - Total allocated = 9 - 7 = 2
Next, I need to calculate the remaining Need for each process using Need = Max - Allocation.
For P1: Need = 7 - 3 = 4
For P2: Need = 6 - 1 = 5
For P3: Need = 5 - 3 = 2
Now let me check which process can be satisfied with Available = 2.
Checking P1: Need(P1) = 4 > Available (2), so P1 cannot execute right now.
Checking P2: Need(P2) = 5 > Available (2), so P2 cannot execute right now.
Checking P3: Need(P3) = 2 ≀ Available (2), so P3 can execute and complete.
Once P3 finishes, it releases its allocated tape drives.
New Available = 2 + Allocation of P3 = 2 + 3 = 5
Now check the remaining processes with Available = 5.
Checking P1: Need(P1) = 4 ≀ Available (5), so P1 can run and complete.
Once P1 finishes, it releases its allocated drives.
New Available = 5 + Allocation of P1 = 5 + 3 = 8
Finally, check P2.
Need(P2) = 5 ≀ Available (8), so P2 can also finish.
A safe sequence exists: <P3, P1, P2>.
Since a safe sequence exists, the system is in a Safe state.
By definition, if a system is in a safe state, it is definitely Not Deadlocked.
Answer:
(B) Safe, Not Deadlocked

Similar Questions

A multithreaded program P executes with x number of threads and uses y number of locks for ensuring mutual exclusion while operating on shared memory locations....
#172 MCQ
P={P1,P2,P3,P4} consists of all active processes in an operating system.R={R1,R2,R3,R4} consists of single instances of distinct types of resources in the syste...
#1455 MCQ
Consider a system consisting of π‘˜ instances of a resource 𝑅, being shared by 5 processes. Assume that each process requires a maximum of two instances of reso...
#1497 Fill in the Blanks

Related Topics

system sharing tape drives GATE computer science 2017 safe state not deadlock process allocation tape drives system safety analysis deadlock prevention GATE set 2 question 2 process requirements tape drives

Unique Visitor Count

Total Unique Visitors

Loading......