GATE CS 2021 (Afternoon) — Question 53

Operating Systems (OS)Deadlock Prevention, Avoidance, Detection, RecoveryMSQ2 marksMedium

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:
code
1function OwnResource (Resource R)
2    Acquire lock L // a global lock
3    if R is available then
4        Acquire R
5        Release lock L
6    else
7        if R is owned by another process P then
8            Terminate P, after releasing all resources owned by P
9            Acquire R
10            Restart P
11            Release lock L
12        end if
13    end if
14end function
15
Which of the following choice(s) about the above scheme is/are correct?
  1. A
    The scheme ensures that deadlocks will not occur.
  2. B
    The scheme may lead to live-lock.
  3. C
    The scheme may lead to starvation.
  4. D
    The scheme violates the mutual exclusion property.
Practise the full 2021-AN paper
Challenge a friend: WhatsApp Telegram
Recommended book · affiliate linkOperating System Concepts (Galvin)Scheduling, synchronisation, deadlocks, memory and file systems.
Practise more on Deadlock Prevention, Avoidance, Detection, RecoveryTimed, in the real exam interface · free to start

A GATE question every morning

One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.

Join
Stuck? Ask in the student group