3,983 views
1 votes
1 votes
Which of the following regarding semaphores are true?

(a) Semaphores always guarantee Mutual Exclusion but fail to guarantee progress

(b) Under certain situations may fail to guarantee Mutual exclusion

(c) Improper usage of semaphore operations may lead to deadlock

(d) Both (a) & (c) are true

1 Answer

Best answer
3 votes
3 votes

various Synchronization mechanism fails because they were not atomic ..solution like lock variable and turn variable tends to fail as they were Unatomic.

Semaphore are provision given by Operating System in which the Semaphore Operations are always done ATOMICALLY ..

so no variable can be prempted during performing UP and DOWN ..so they will always GIVES MUTX

But they cant assure Progress....

Improper implementation of Semaphore leads to deadlock ..

Say we have P1 and P2 ..2 semaphore variable are S and K so 

P1 P2
Down(S) Down(K)
Down(K) Down(S)
 code Code

 here process goes to deadlock ...if they perform Down(S) and Down(K) at the same time.\

SO most appropriate answer is D

selected by
Answer:

Related questions

0 votes
0 votes
1 answer
1
roopkathaaa asked Aug 25, 2023
1,311 views
In a certain application, the initial value of a counting semaphore s is 10. The following operations were completed on the semaphore in the given order 5P, 20P, 2V, 18P,...
0 votes
0 votes
0 answers
4
Arbaz__Malik asked Dec 25, 2021
643 views
given solution is wait(P) , wait(Q), wait(p) , wait(Q) for s1,s2,s3,s4 respectivelyI know this implementation is deadlock free just want to ask if it will follow bounded ...