Explain Readers-writers problem.
Readers-writers problem: Assume that a data object (as a file or record) is to be shared between several concurrent processes. The readers are processes which are interested in only reading the content of shared data-object. Writers are the processes which may need to update (i.e. to read and write) the shared data object. No adverse effects will result, if two readers access the shared data object simultaneously. Though, if a writer and some other process (either a writer or reader) access the shared object concurrently, anomaly may arise. To make sure that these difficulties do not occur, writers are needed to have exclusive access to the shared object. Such synchronization problem is referred to as the problem of readers-writers.