11.5. The multiple readers, single writer problem

A style of competition between processes which is more complex than simple mutual exclusion arises when many processes may be allowed to read a resource simultaneously (since they make no change to it) but writers must have exclusive access. Any solution to this problem must make an assumption about relative priorities. Here we shall assume that as soon as a writer wishes to write, all current readers are allowed to finish reading but any subsequent request to read is held up. This priority scheme is appropriate when it is important that readers read information which is as up to date as possible.

Semaphores are used to manage the situation where processes need to block:

  • Semaphore R = new SemaphoreImplementation ...

Get Operating Systems: Concurrent and Distributed Software Design now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.