884 views

1 Answer

Best answer
1 1 vote

Assuming 6th last line is r – – ;

  1. Going for option A:

There can be more than 100 readers reading, this is breaking the rule as question mentioned maximum 100 readers.

  1. Going for option C&D:

Reader 1: Comes make m = 0 then make s = 99 and m = 1 → Reading

Reader 2: Comes make m = 0 then make s = 98 and m = 1 → Reading

Reader 100: Comes make m = 0 then make s = 0 and m = 1 → Reading

Reader 101: Comes make m = 0 then waiting for s.

Now Reader 1 finish reading… While going out he needs to down(m) but can’t do since it is holded by Reader 101. We got into deadlock.

 

Hence I think B should be correct option.

• selected by
Position:
Show:

Related questions

5 5 votes
3 answers 3 answers
2.8k
2.8k views
Purple asked Jan 29, 2016
2,767 views
Suppose we want to synchronize two concurrent processes P and Q using binary semaphores S, T and U:Process P: Process Q:P(S) ...
3 3 votes
4 4 answers
2.9k
2.9k views
0 0 votes
0 0 answers
1.2k
1.2k views
Magma asked Nov 19, 2018
1,183 views
I think that statement iii is false , deadlock can arise in both semaphore as well as monitor (mutex)
1 1 vote
1 answers 1 answer
1.4k
1.4k views
vishwa ratna asked Nov 8, 2017
1,415 views
It says as follows:PseudocodeInteger X = 0 , Y = 23 ;Semaphore mx = 1 , my = Null ;Codebegin Begin P(mx); x= x+1; V(my); End...