Last Updated: June 6, 2026
A plain mutual exclusion lock treats every operation the same. Whether a thread is reading a value or modifying it, the lock lets exactly one thread through at a time. That's safe, but it's wasteful when reads vastly outnumber writes. Reading a price from a product catalog doesn't change anything, so blocking ten reader threads while one of them does the read is throwing parallelism away. ReadWriteLock is Java's answer to that waste. It allows many readers to hold the lock at the same time, or one writer alone, never both. This lesson covers the ReadWriteLock interface, its concrete implementation ReentrantReadWriteLock, the read and write views it exposes, lock downgrading, why upgrading is forbidden, the fair vs unfair flavor, and a short look at StampedLock as a higher-throughput alternative.
The previous chapter covered ReentrantLock and its Condition objects in detail. Here we build on that mental model. ReadWriteLock doesn't replace ReentrantLock; it specializes it for a different access pattern.