Last Updated: February 2, 2026
The Unisex Bathroom problem is a classic synchronization challenge that combines mutual exclusion between groups with concurrent access within groups.
A bathroom can hold multiple people, but only if they're all of the same gender. When one gender is using the bathroom, the other must wait. When the bathroom empties, either gender can enter.
This problem is a generalization of the readers-writers problem. Instead of readers and writers, we have men and women. Instead of "readers can share, writers need exclusivity," we have "same gender can share, different gender is excluded."