Question:medium

Consider a computer system with multiple shared resource types, with one instance per resource type. Each instance can be owned by only one process at a time. Owning and freeing of resources are done by holding a global lock \(L\). The following scheme is used to own a resource instance: 

function OwnResource(Resource R) 
     Acquire lock L // a global lock 
     if R is available then 
          Acquire R 
          Release lock L 
     else 
          if R is owned by another process P then 
               Terminate P, after releasing all resources owned by P 
               Acquire R 
               Restart P 
               Release lock L 
          end if 
     end if 
end function

Which of the following choice(s) about the above scheme is/are correct? 
 

Show Hint

Deadlock avoidance through forced preemption can introduce live-lock and starvation if fairness is not ensured.
Updated On: Feb 2, 2026
  • The scheme ensures that deadlocks will not occur.
  • The scheme may lead to live-lock.
  • The scheme may lead to starvation.
  • The scheme violates the mutual exclusion property.
Show Solution

The Correct Option is A, B, C

Solution and Explanation

The question describes a resource allocation scheme in a computer system with the following key features:

  • Each type of resource has only one instance, which can be owned by only one process at a time.
  • Resource allocation and deallocation are controlled through a global lock \( L \).
  • If a resource is already owned by another process \( P \), the owning process is terminated, its resources released, and then it is restarted after the current process acquires the needed resource.

We need to analyze each given option to determine which statements about the scheme are correct:

  1. The scheme ensures that deadlocks will not occur.

A deadlock occurs when a set of processes are blocked because each process is holding a resource and waiting for another that is held by another process. This scheme avoids deadlocks by ensuring that if a resource is already owned, the owning process is forcibly terminated and its resources are released, preventing circular wait. Therefore, this statement is correct.

  1. The scheme may lead to live-lock.

A live-lock occurs when processes continuously change their state in response to other processes without making progress. In this scheme, if two or more processes frequently request the same resources, the constant termination and restarting of processes could cause them to remain in a state of flux without making progress. Thus, live-lock is a possibility, making this statement correct.

  1. The scheme may lead to starvation.

Starvation occurs when a process is perpetually denied necessary resources to proceed with its operation. Since a process could be continuously terminated if another process always requests its owned resources, starvation is a significant risk in this scheme. Hence, this statement is also correct.

  1. The scheme violates the mutual exclusion property.

The mutual exclusion property requires that a resource is held by only one process at a time. The scheme uses a global lock and ensures that resources are acquired and released such that mutual exclusion is maintained. Therefore, this statement is incorrect.

To summarize, the correct statements are:

  • The scheme ensures that deadlocks will not occur.
  • The scheme may lead to live-lock.
  • The scheme may lead to starvation.
Was this answer helpful?
0