readers writers variations - TarisMajor/5143-OpSystems GitHub Wiki
Readers-Writers Variations
The Readers-Writers Problem deals with scenarios where multiple processes need to access shared data, such as a file or database. The problem differentiates between "readers," who only read the data, and "writers," who modify the data. The key challenge is to ensure mutual exclusion while allowing concurrent reading to maximize system performance.
Variations:
First-come, first-served readers-writers: This variation ensures that once a reader has acquired the lock, other readers can access the data concurrently, but writers are blocked until all readers finish.
Writer-preference: In this variation, writers are given priority over readers. Once a writer is ready, it is allowed to enter the critical section, even if readers are waiting. This avoids the scenario where writers are starved by an excessive number of readers.
Reader-preference: Here, readers are given priority over writers. Once a reader is allowed to enter, other readers can also access the data concurrently, but writers are delayed until all readers finish.
Fair readers-writers: This variation ensures fairness by guaranteeing that no process (reader or writer) is indefinitely delayed or starved. It provides equal opportunity for both readers and writers to access the critical section.
Source: Henzinger, T. A., & Raghunathan, M. (1998). "The Readers-Writers Problem". Springer-Verlag.