A system has 3 resources and 5 processes competing for them. Each proc...
Distribute each process to one less than maximum request resources i.e. 5(N - 1)
Total no. of resources = 5(N - 1) + 1 = 5N - 2
If total no. resources are greater than given resources then a deadlock will occur.
5N – 2 <= 3
5N <= 5
N <= 1
View all questions of this test
A system has 3 resources and 5 processes competing for them. Each proc...
Explanation:
To understand why the largest value of N that will always avoid deadlock is 1, we need to understand the concept of deadlock and how it can occur in a system with limited resources.
Deadlock:
Deadlock is a situation in which two or more processes are unable to proceed because each is waiting for the other to release a resource. In other words, deadlock occurs when there is a circular dependency of resources among processes, resulting in a state where no process can proceed.
Resource Allocation:
In a system with limited resources, it is important to allocate resources effectively to avoid deadlock. Each process can request a maximum of N instances of a resource. In this case, we have 3 resources and 5 processes competing for them.
Resource Allocation Graph:
To analyze the resource allocation and possibility of deadlock, we can create a resource allocation graph. In this graph, each process is represented by a node, and each resource is represented by a resource instance. If a process requests a resource instance, there is an edge from the process node to the resource instance node.
Possible Scenarios:
Let's analyze different values of N and their impact on deadlock:
1. N = 1:
- In this case, each process can request only 1 instance of a resource.
- If a process requests a resource, it can be allocated if available, otherwise, it will wait until the resource is released.
- Since there are 3 resources and 5 processes, it is possible for all processes to acquire at least 1 resource and continue execution.
- This ensures that no circular dependency of resources occurs, avoiding deadlock.
2. N > 1:
- If N is greater than 1, a process can request multiple instances of a resource.
- Suppose N = 2, and all 5 processes request 2 instances of a resource simultaneously.
- In this case, deadlock can occur if each process holds 2 instances and waits for the remaining 1 instance to be released by other processes.
- This creates a circular dependency, resulting in a deadlock state.
Conclusion:
The largest value of N that will always avoid deadlock is 1. By limiting the maximum instances a process can request to 1, we ensure that each process can acquire at least 1 resource and continue execution, avoiding the possibility of a circular dependency and deadlock.
A system has 3 resources and 5 processes competing for them. Each proc...
Thanks..
To make sure you are not studying endlessly, EduRev has designed Computer Science Engineering (CSE) study material, with Structured Courses, Videos, & Test Series. Plus get personalized analysis, doubt solving and improvement plans to achieve a great score in Computer Science Engineering (CSE).