Question
Download Solution PDFConsider a system with five processes P0, through P4, and three resource types A, B and C. Resource type A has seven instances, resource type B has two instances and resource type C has six instances suppose at time T0 we Have the following allocation.
Process |
Allocation |
Request |
Available |
||||||
|
A |
B |
C |
A |
B |
C |
A |
B |
C |
P0 |
0 |
1 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
P1 |
2 |
0 |
0 |
2 |
0 |
2 |
|
||
P2 |
3 |
0 |
3 |
0 |
0 |
0 |
|||
P3 |
2 |
1 |
1 |
1 |
0 |
0 |
|||
P4 |
0 |
2 |
2 |
0 |
0 |
2 |
If we implement Deadlock detection algorithm we claim that system is ______.
Answer (Detailed Solution Below)
Detailed Solution
Download Solution PDFThe correct answer is "option 4".
CONCEPT:
Deadlock is a condition in which a process P1 wants a resource that is held by any other process P2 & process P2 wants a resource that is held by process P1.
No processes that are in deadlock can further proceed and get blocked.
EXPLANATION:
Deadlock detection algorithm is used to detect any chance of deadlock while allocating resources to the processes.
If any process will cause or has a chance of creating a deadlock, then this algorithm will not give resources to that particular process causing deadlock.
Steps of deadlock detection algorithm:
1.Deadlock detection algorithm will check that process requesting resources are available.
Request <= Available
2. If the above condition gets satisfied then the algorithm will allocate the resources demanded by the process.
Also, after fulfilling the request, availability gets added with the allocation of that process.
available = available + allocation
3. Else, the algorithm will keep the process till its next turn.
CALCULATION:
Step 1.
Process P0 is requesting instances (0,0,0) and it is available
(0,0,0) <= (0,0,0)
so, P0 will get the resources:
available = (0,0,0) + (0,1,0) = (0,1,0) { A - 0 instance, B - 1 instance , C - 0 instance }
Step 2.
Process P1 is requesting instances (2,0,2) it is not available
(2,0,2) > (0,1,0) { request < available }
so, P2 will wait.
Step 3.
Process P2 is requesting instances (0,0,0) and it is available
(0,0,0) < (0,1,0)
so, P2 will get the resources:
available = (0,1,0) + (3,0,3) = (3,1,3) { A - 3 instance, B - 1 instance , C - 3 instance }
Step 4.
Process P3 is requesting instances (1,0,0) and it is available
(1,0,0) < (3,1,3)
so, P3 will get the resources:
available = (3,1,3) + (2,1,1) = (5,2,4) { A - 5 instance, B - 2 instance , C - 4 instance }
Step 5.
Process P4 is requesting instances (0,0,2) and it is available
(0,0,2) < (5,2,4)
so, P4 will get the resources:
available = (5,2,4) + (0,0,2) = (5,2,6) { A - 5 instance, B - 2 instance , C - 6 instance }
Step 6.
Process P1 is requesting instances (2,0,2) and it is available
(2,0,2) < (5,2,6)
so, P1 will get the resources:
available = (5,2,6) + (2,0,0) = (7,2,6) { A - 7 instance, B - 2 instance , C - 6 instance }
Also, detection algorithm create safe sequence i.e. sequence of resource allocated processes without any deadlock.
Here, safe sequence is <P0,P2,P3,P4,P1>
Hence, the system is not in a deadlock state.
Important Points
If a system is in the safe state then the system is not in a deadlock state but if the system is not in the safe state then the system may or may not be in a deadlock state.
Mistake Points
Always compare as follows:
(1,2,3) < (1,0,0) means 1<1, 2<0 & 3<0
Never check as :123<100
Last updated on Jul 7, 2025
-> The UGC NET Answer Key 2025 June was released on the official website ugcnet.nta.ac.in on 06th July 2025.
-> The UGC NET June 2025 exam will be conducted from 25th to 29th June 2025.
-> The UGC-NET exam takes place for 85 subjects, to determine the eligibility for 'Junior Research Fellowship’ and ‘Assistant Professor’ posts, as well as for PhD. admissions.
-> The exam is conducted bi-annually - in June and December cycles.
-> The exam comprises two papers - Paper I and Paper II. Paper I consists of 50 questions and Paper II consists of 100 questions.
-> The candidates who are preparing for the exam can check the UGC NET Previous Year Papers and UGC NET Test Series to boost their preparations.