Problem 2

Calculate the maximum number of resources one process can ask?

Given the number of resources and number of processes available in the system, calculate the maximum number of resources one process can ask without leading to any deadlock combination.

A given system has n processes and m instances of a certain resource type. Each process can request maximum of k instances at a certain point of time. What is the largest value of k that will always avoid deadlock?

Approach

  • From problem 1 we know that in order to avoid deadlock, .
  • Now replacing the value of Swith given value k we get,
  • Simplifying the above equation we will get,
  • So k is less than or equal to (m + n – 1)/n

So the maximum number of resources one process can ask is (m + n – 1)/n.

Relation Between Number of Processes and Number of Resources to Prevent Deadlock

A set of blocked processes where each process is holding some resource and waiting to acquire some other resource held by another process in the set. This situation is called deadlock in the operating system.

Deadlock can be prevented if the number of resource instances in a system is significantly larger than the number of processes asking for a resource. In this article, we are going to understand the relation between a number of processes and a number of resources to prevent deadlock based on the two following problem statements:

  • Given the maximum number of resources asked by each process, calculate the minimum number of resources required to permanently avoid deadlock.
  • Given the number of resources and number of processes available in the system, calculate the maximum number of resources one process can ask without leading to any deadlock combination.

Similar Reads

Problem 1

Calculate the minimum number of resources required....

Problem 2

Calculate the maximum number of resources one process can ask?...

Relevant GATE Questions

GATE CS 2018 | Question 30...