0 votes
0 votes

in Operating System
160 views

1 Answer

1 vote
1 vote
Best answer

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
by

1 comment

Thanks! Got it
0
0

Related questions