Unisex Bathroom Problem
A synchronization practice problem requiring us to synchronize the usage of a single bathroom by both the genders.
We'll cover the following
Unisex Bathroom Problem
A bathroom is being designed for the use of both males and females in an office but requires the following constraints to be maintained:
There cannot be men and women in the bathroom at the same time.
There should never be more than three employees in the bathroom simultaneously.
The solution should avoid deadlocks. For now, though, don’t worry about starvation.
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.