Assuming 6th last line is r – – ;
- Going for option A:
There can be more than 100 readers reading, this is breaking the rule as question mentioned maximum 100 readers.
- 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.