Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

GATE | GATE IT 2006 | Question 55

  • Difficulty Level : Hard
  • Last Updated : 28 Jun, 2021

Consider the solution to the bounded buffer producer/consumer problem by using general semaphores S, F, and E. The semaphore S is the mutual exclusion semaphore initialized to 1. The semaphore F corresponds to the number of free slots in the buffer and is initialized to N. The semaphore E corresponds to the number of elements in the buffer and is initialized to 0.
Which of the following interchange operations may result in a deadlock?

  1. Interchanging Wait (F) and Wait (S) in the Producer process
  2. Interchanging Signal (S) and Signal (F) in the Consumer process

(A) I Only
(B) II Only
(C) Neither I nor II
(D) Both I and II


Answer: (A)

Explanation: Suppose F = 0. Now, if Wait(F) and Wait(S) are interchanged and Wait(S) in producer succeeds, the producer will wait for Wait(F) which is signalled in Consumer, which is never going to succeed as it is waiting for Wait(S) to be signal by producer. So, deadlock can happen.

Quiz of this Question

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!