liveBook · Manning

Reader-writer problem

The reader-writer problem is a concurrency problem in which multiple readers may access shared data concurrently while writers require exclusive access.

How 3 Manning books explain it

Software Design for Python Programmers

The reader-writer problem is a concurrency problem involving shared access where readers may proceed concurrently but writers require exclusive modification access.

How it is used
Coordinates multithreaded access to shared resources when reads can overlap but modifications must be exclusive.
How deep it goes
Demonstrates mutex and semaphore coordination through a meter simulation, stopping short of a general reader–writer algorithm.
Examples
Uses technicians writing meter settings, loggers reading them, and a timed execution trace.
What you can do after
Build it from scratch using Python locks and semaphores to coordinate concurrent readers and exclusive writers.

Read how Software Design for Python Programmers explains reader-writer problem →

Object-Oriented Software Design in C++

The reader-writer problem is a concurrency coordination problem involving concurrent readers and writers of shared data with potentially conflicting access requirements.

How it is used
Coordinates technician updates and logger reads of a shared meter in a multithreaded application.
How deep it goes
Defines exclusive and shared locking with a worked C++ example, without detailing synchronization internals beyond lock behavior.
Examples
Uses a shared meter, technician writers, logger readers, lock-scoped C++ methods, and concurrent program output.
What you can do after
Apply it via C++ shared_mutex, unique_lock, and shared_lock to protect shared data with distinct read and write access.

Read how Object-Oriented Software Design in C++ explains reader-writer problem →

Grokking Concurrency

The readers-writer pattern coordinates concurrent access so multiple readers can share a resource while writers receive exclusive access.

How it is used
Coordinates shared-data access when reads are frequent and changes are occasional.
How deep it goes
Defines the access rules and demonstrates a Python lock implementation, without developing fairness policies.
Examples
Uses a library catalog, Python User and Librarian threads, a shared counter, and sample concurrent output.
What you can do after
Apply it via Python threading by implementing and using an RWLock for shared counters or other read-heavy data.

Read how Grokking Concurrency explains reader-writer problem →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.