Skip to content
GATEiit

GATE CSE 2017 Session 1 Q37: Minimum threads and non-reentrant locks for a possible deadlock

Syllabus topic: Deadlock

Question

A multithreaded program P executes with x number of threads and uses y number of locks for ensuring mutual exclusion while operating on shared memory locations. All locks in the program are non-reentrant, i.e., if a thread holds a lock l, then it cannot re-acquire lock l without releasing it. If a thread is unable to acquire a lock, it blocks until the lock becomes available. The minimum value of x and the minimum value of y together for which execution of P can result in a deadlock are:

Try it: multiple choice: exactly one correct option

Select one option
Wrong answer costs 2/3 mark in GATE.
Show answer and explanation

Answer: D (official GATE 2017 final answer key)

Concept used: With non-reentrant locks, a thread that tries to acquire a lock it already holds blocks on itself forever.

Concept notes

Loading notes…

First step: Ask whether a single thread with a single lock can block forever, given the non-reentrant rule.

Full step-by-step solution

Loading…

Answer from the official final answer key. Found a mistake? Use Report issue and we will fix it.

More questions on Deadlock

Every PYQ on this topic →

Share this question

WhatsAppDownload image

Source: official GATE 2017 Session 1 CS question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key