Read/write lock pattern

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 of pthread_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_mutex boost::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.

Игры ⚽ Нужен реферат?

Look at other dictionaries:

  • Lock (computer science) — In computer science, a lock is a synchronization mechanism for enforcing limits on access to a resource in an environment where there are many threads of execution. Locks are one way of enforcing concurrency control policies. Contents 1 Types 2… …   Wikipedia

  • Readers–writer lock — In computer science, a readers writer or shared exclusive lock (also known as the multiple readers / single writer lock[1] or the multi reader lock,[2] or by typographical variants such as readers/writers lock) is a synchronization primitive that …   Wikipedia

  • Scheduler pattern — In computer programming, the scheduler pattern is a software design pattern. It is a concurrency pattern used to explicitly control when threads may execute single threaded code.The scheduler pattern uses an object that explicitly sequences… …   Wikipedia

  • Concurrency pattern — In software engineering, concurrency patterns are those types of design patterns that deal with multi threaded programming paradigm. Examples of this class of patterns include: Active Object[1][2] Balking pattern Double checked locking pattern… …   Wikipedia

  • Software design pattern — In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. A design pattern is not a finished design that can be transformed directly into code. It is a… …   Wikipedia

  • Balking pattern — The Balking pattern is a software design pattern that only executes an action on an object when the object is in a particular state. For example, if an object reads ZIP files and a calling method invokes a get method on the object when the ZIP… …   Wikipedia

  • Lock-free and wait-free algorithms — In contrast to algorithms that protect access to shared data with locks, lock free and wait free algorithms are specially designed to allow multiple threads to read and write shared data concurrently without corrupting it. Lock free refers to the …   Wikipedia

  • Key (lock) — A cut key A key is an instrument that is used to operate a lock. A typical key consists of two parts: the blade, which slides into the keyway of the lock and distinguishes between different keys, and the bow, which is left protruding so that… …   Wikipedia

  • Шаблон проектирования — У этого термина существуют и другие значения, см. Паттерн. В разработке программного обеспечения, шаблон проектирования или паттерн (англ. design pattern) повторимая архитектурная конструкция, представляющая собой решение проблемы… …   Википедия

  • Vendor lock-in — Marketing Key concepts Product marketing · Pricing …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”