Readers and Writers problem

The readers and writers problem is quite straightforward: we have a database which many users are allowed to read simultaneously, but to which only one user may write at a time (to avoid race conditions in the database). So it is identical to the mutual exclusion problem, except that we wish to permit more flexibility in the system by letting more than one simultaneous reader. Naturally there is no danger of a race condition when many tasks are reading from a shared data structure.

One solution uses semaphores.

last updated 1998