question archive Describe a scenario in which the use of a reader-writer lock is more appropriate than using another synchronization tool, such as a semaphore
Subject:Computer SciencePrice:9.82 Bought3
Describe a scenario in which the use of a reader-writer lock is more appropriate than using another synchronization tool, such as a semaphore.

SCENARIO
Reader-writer locks are used to safeguard data that is only accessed by the user for the purpose of reading. While semaphores serialize access to the data, this lock allows several threads to access the data at the same time.
It's expensive to build reader-writer locks, thus they're utilized only on large parts of code.
If an application has more readers than authors, reader-writer locks might be advantageous. This is due to the fact that setting up a semaphores lock needs less overhead. In order to compensate for the expense of setting up the reader-writer lock, multiple readers are allowed. Reader writer lock is useful the minute it is easy to differentiate whether a method is reading or writing/ reading shared data when using semaphore.

