1.1 Demonstrate that the original code does not meet the requirements.
1.2 The problem in 1.1 could be fixed by adding a single semaphore (e.g. v) that protects each of the double-waits as a critical section. Detail this solution (write the code). What are the limitations of such a solution? Demonstrate.
1.3 Without adding semaphores to the original code, propose a solution that meets the requirements and does not suffer from the weaknesses of the solution proposed in 1.2
Please modify the reader/writers solution (lecture 3 slide 27) to be a fair solution: Neither readers get priority nor writers get priority. i.e. even if readers keep coming, writers will not wait for ever, and even if writers keep coming, readers will not wait forever. Still several readers should be able to read simultaneously.
You can assume that all semaphores are FIFO semaphores.
The simpler the solution the better. So please come with the simplest possible solution.
Submit homework in class, Wednesday October 18, 2000.
Homework has to be typed (rather than written by hand).