Open In App

GATE | GATE-CS-2015 (Set 3) | Question 65

Like Article
Like
Save Article
Save
Share
Report issue
Report

Two processes X and Y need to access a critical section. Consider the following synchronization construct used by both the processes.

Q20

Here, varP and varQ are shared variables and both are initialized to false. Which one of the following statements is true?

(A) The proposed solution prevents deadlock but fails to guarantee mutual exclusion
(B) The proposed solution guarantees mutual exclusion but fails to prevent deadlock
(C) The proposed solution guarantees mutual exclusion and prevents deadlock
(D) The proposed solution fails to prevent deadlock and fails to guarantee mutual exclusion


Answer: (A)

Explanation: When both processes try to enter critical section simultaneously,both are allowed to do so since both shared variables varP and varQ are true.So, clearly there is NO mutual exclusion. Also, deadlock is prevented because mutual exclusion is one of the four conditions to be satisfied for deadlock to happen.Hence, answer is A.

Quiz of this Question


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads