The Readers Writers Problem

Learning Objectives

At the end of this lecture, you should be able to:

  • Use mutex locks and condition variables to solve a famous concurrency problem.

Topics

In this lecture, we will cover the following topics:

  • Mutex locks.
  • Condition variables.
  • The readers and writers problem.

Notes

The Readers and Writers Problem

Analogy: The College Dorm Room Party

Approach 1: Taking Turns

Problems with Approach 1

Approach 2: Dealing with Starvation