- Read/write lock pattern
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 ofpthread_rwlock_t
and the [http://www.opengroup.org/onlinepubs/009695399/functions/pthread_rwlock_init.html associated operations] .Java version 5 or above includes an interface named
java.util.concurrent.locks.ReadWriteLock
that allows the use of this pattern.Also, the
Boost C++ Libraries include a read/write lock in the form of [http://www.boost.org/doc/libs/1_36_0/doc/html/thread/synchronization.html#thread.synchronization.mutex_types.shared_mutexboost::shared_mutex
] .ee also
*
Lock pattern
*Semaphore
*Mutex
*Scheduler pattern
*Balking pattern
*Lock (software engineering) External links
* [http://doc.trolltech.com/qq/qq11-mutex.html Good explanation of the implementation of a read/write lock]
Wikimedia Foundation. 2010.