subject

We consider a 201-threaded process with multiple phases. Whenever a thread finishes a phase, it will call checkpoint(). If fewer than half of all the threads are in sleep it will be put into sleep as well, otherwise, it will wake up all of the sleeping thread and they will together proceed to the next phase. Implement checkpoint() with help of mutex and condition variable, the pseudo syntax of which is defined here:
mutex m; cond c;
mutex_init(m, NULL);
cond_init(c, NULL);
mutex_lock(m);
mutex_unlock(m); cond_wait(c, m); cond_signal(c); cond_broadcast(c);
Use the following code framework. mutex m; cond c; mutex. init(m, NULL); cond. init(c, NULL); * Put any additional variables and/or their initial values below * /* It is called whenever a thread finishes a phase */ void checkpoint () {

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
Lisa’s company, abc ltd., lost its biggest client and is now facing a financial crunch. most of her colleagues have resigned, but lisa decides to stay with the company and assist the management in overcoming the financial situation. which quality is lisa demonstrating? a. self-management b. cooperativeness c. responsibility d. loyalty
Answers: 2
question
Computers and Technology, 22.06.2019 13:30
Jane’s team is using the v-shaped model for their project. during the high-level design phase of the project, testers perform integration testing. what is the purpose of an integration test plan in the v-model of development? a. checks if the team has gathered all the requirements b. checks how the product interacts with external systems c. checks the flow of data in internal modules d. checks how the product works from the client side
Answers: 1
question
Computers and Technology, 22.06.2019 15:30
Whats are the different parts of no verbal comunication, especially body language?
Answers: 3
question
Computers and Technology, 23.06.2019 19:00
Whose task it is to ensure that the product flows logically from one step to another?
Answers: 3
You know the right answer?
We consider a 201-threaded process with multiple phases. Whenever a thread finishes a phase, it will...
Questions
question
Mathematics, 06.04.2021 02:10
Questions on the website: 13722362