subject

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
*
*
*
* /
}
};

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:00
Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive. after the loop terminates, it prints out, on a line by itself and separated by spaces, the sum of all the even integers read, the sum of all the odd integers read, a count of the number of even integers read, and a count of the number of odd integers read, all separated by at least one space. declare any variables that are needed. assume the availability of a variable, stdin, that references a scanner object associated with standard input. that is, stdin = new scanner(system.in); is given.
Answers: 3
question
Computers and Technology, 24.06.2019 01:00
What are two ways to access the options for scaling and page orientation? click the home tab, then click alignment, or click the file tab. click the file tab, then click print, or click the page layout tab. click the page layout tab, or click the review tab. click the review tab, or click the home tab?
Answers: 2
question
Computers and Technology, 24.06.2019 09:50
Self contained sequences of actions to be performed are? a. expressions b. algorithms c. functions d. formulas
Answers: 1
question
Computers and Technology, 24.06.2019 17:30
List at least one thing to check for when you're checking the clarity and professionalism of a document.
Answers: 1
You know the right answer?
In an office there is a unisex bathroom with n toilets. The bathroom is open to both men and women,...
Questions
question
Mathematics, 16.08.2020 01:01
question
Mathematics, 16.08.2020 01:01
question
History, 16.08.2020 01:01
question
English, 16.08.2020 01:01
question
English, 16.08.2020 01:01
question
English, 16.08.2020 01:01
question
English, 16.08.2020 01:01
question
History, 16.08.2020 01:01
Questions on the website: 13722360