Computers and Technology, 15.04.2020 22:45 Pizzzzza
In an office there is a unisex bathroom with n toilets. The bathroom is open to both men and women, but it cannot be used by men and women at the same time. Develop a concurrent program that simulates the above scenario using semaphores. Your solution should be deadlock free, but it does not have to be starvation free. Note that your program has to implement two functions arriveAtTheBathroom(type) and leaveTheBathroom(type), where type is either MAN or WOMAN
#include ".cpp"
#include
class MyBathroomProblemSolver : public
{
int n;//Number of toilets
public:
MyBathroomProblemSolver(int n)
{
this->n = n;
}
void arriveAtTheBathroom(gender type) override
{
throw std::runtime_error("Not Implemented");
/
*
*
* Your Code goes here
*
*
*
* /
}
void leaveTheBathroom(gender type) override
{
throw std::runtime_error("Not Implemented");
/
*
*
* Your Code goes here
*
*
*
* /
}
};
Answers: 1
Computers and Technology, 21.06.2019 19:30
Why is it a good idea to leave an interview being courteous and polite?
Answers: 1
Computers and Technology, 21.06.2019 21:30
What elements related to the release and success of the nes console do you see in modern console releases? what elements are no longer relevant to modern console gaming?
Answers: 3
Computers and Technology, 22.06.2019 11:00
The great length of north america causes the climate to be varied. true false
Answers: 2
Computers and Technology, 24.06.2019 06:50
What are the things you are considering before uploading photos on social media?
Answers: 1
In an office there is a unisex bathroom with n toilets. The bathroom is open to both men and women,...
Advanced Placement (AP), 15.01.2020 20:31
Advanced Placement (AP), 15.01.2020 20:31
Mathematics, 15.01.2020 20:31