locking

Reader/Writer Lock Pattern
Concurrency locking
Published: 2010-03-04
Reader/Writer Lock Pattern
A reader-writer lock is a lock which will allow multiple concurrent readers but only one writer. A reader-writer lock can be significantly more efficient than a standard mutex if reads on your shared memory far outnumber writes. Reader-writer locks naturally fit together with caches, as caches are only effective if reads far outnumber writes. Here is a general pattern for using a reader-writer lock with a cache: Acquire a reader lock. Read more...