In: Computer Science
Explain what is the problem with this implementation of the one-writer many-readers problem?
The code for the one-writer many readers is fine if we assume that the readers have always priority. The problem is that the readers can starve the writer(s) since they may never all leave the critical region, i.e., there is always at least one reader in the critical region, hence the €˜wrt' semaphore may never be signaled to writers and the writer process does not get access to €˜wrt' semaphore and writes into the critical region.
The code for the one-writer many readers is fine if we assume that the readers have always priority.