Sweta tiwari Asked a Question
July 14, 2021 10:31 ampts 30 pts
If writers writes in database, readers/wTiters are not allowed in database. Ques. Oes. Consider the procedure below for producer consumer problem which uses semaphore n = 0 S 1 Void producer () Void consumer () produce O sem wait (S) sem wait (s) sem wait (n) add to buffer () remove from buffer ) sem signal (s) sem signal (s) sem signal (n) consume () Which one of the following is true? (A) Producer will be able to add item to the buffer but consumer will never be able to consume it. (B) Consumer will not remove more than one item from the buffer. (C) Deadlock occurs if the consumer succeeds in acquiring semaphore, when buffer is empty. (D) The starting value for the semaphore S, n must be 1 & not 0 for deadlock free operation. Ans. (C) Consumer executes wait(s) than wait(n) & goes to sleep. After consumer sleep, producer goes to sleep wait(s).
  • 1 Answer(s)
  • Shares
  • Komal bhati thankyou
    check explaination. hope you got it..
    • cropped6711310877977316358.jpg
    Likes(0) Reply(0)
Head Office :
MPA 44, 2nd floor, Rangbari Main Road,
Mahaveer Nagar II, Kota (Raj.) – 324005

Corporate Office:
212, F-1, 2nd Floor, Evershine Tower,
Amrapali Marg,
Vaishali Nagar, Jaipur (Raj.) – 302021

Mail: info@eduncle.com
All Rights Reserved © Eduncle.com