954 views

1 Answer

0 votes
0 votes

There is no busy wait in the above implementation of semaphores it's just that the methods wait() and signal() are accessing shared variable value, 

s->value-- in wait() method and s->value++ in signal() method.

 So this also becomes a critical section problem which would be resolved again. So in a way, we have reduced busy waiting to the wait() and signal() methods.

Related questions

0 votes
0 votes
1 answer
2
0 votes
0 votes
1 answer
3
Mrityudoot asked Jan 27
177 views
Can a counting semaphore acquire a negative value?S = 2;15 P operations done, should the semaphore be 0 or -13