Skip to main content
PreparationZone Logo
PreparationZone
Back to Fundamentals

Fundamentals · Hard · Free

Explain the readers–writers problem and common solutions.

FresherFundamentalsOperating Systems
Model answer

Readers–writers

Many readers can share data concurrently, but writers need exclusive access. Solutions: reader-priority, writer-priority, or fair policies to avoid starvation.

  • Use read-write locks (ReentrantReadWriteLock).
  • Starvation if writers always blocked by endless readers—pick policy for product.
Real example: config cache read-heavy, rare admin updates.