Read/write lock pattern
From Wikipedia, the free encyclopedia
| It has been suggested that this article or section be merged into readers-writer lock. (Discuss) |
| This article does not cite any references or sources. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. (June 2007) |
A read/write lock pattern or simply RWL is a software design pattern that allows concurrent read access to an object but requires exclusive access for write operations.
In this pattern, multiple readers can read the data in parallel but an exclusive lock is needed while writing the data. When a writer is writing the data, readers will be blocked until the writer is finished writing.
The current edition of the POSIX standard includes a read-write lock in the form of pthread_rwlock_t and the associated operations.
Java version 5 or above includes an interface named java.util.concurrent.locks.ReadWriteLock that allows the use of this pattern.
C# and other .NET languages have System.Threading.ReaderWriterLockSlim. [1]
Also, the Boost C++ Libraries include a read/write lock in the form of boost::shared_mutex.

