Skip to content
GATEiit

GATE CSE 2021 Set 2 Q53: Resource scheme that kills and restarts the owner

Question

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?

Try it: multiple select: one or more correct options

Select one or more options
Select all correct options. No negative marking, no partial marks.
Show answer and explanation

Answer: A, B, C (official GATE 2021 final answer key)

Concept used: Pre-empting resources (killing the holder) breaks the no-preemption condition for deadlock, at the cost of repeated restarts.

First step: Check the four Coffman conditions: which one does the scheme remove? Then imagine two processes repeatedly taking each other's resource.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2021 Set 2 CS question paper and final answer key, organised by IIT Bombay. Question paper · Answer key