Read-Write Lock

Noun · Development

Definitions

  1. A lock that distinguishes between shared (read) and exclusive (write) access: multiple readers can hold the lock concurrently, but a writer requires exclusive access and blocks until all readers release. Implementations include Java's ReentrantReadWriteLock, Go's sync.RWMutex, and POSIX pthread_rwlock_t.

    In plain English: A lock with two modes — one that lets many threads read at once, and another that gives one thread exclusive access to make changes.

    Example: "We replaced the mutex with an RWLock and throughput on the read path jumped 8x because readers no longer block each other."

Related Terms