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, 21.06.2019 17:20
Q-1 which of the following can exist as cloud-based it resources? a. physical serverb. virtual serverc. software programd. network device
Answers: 3
question
Computers and Technology, 22.06.2019 05:20
Write a program called assignment3 (saved in a ļ¬le assignment3.java) that computes the greatest common divisor of two given integers. one of the oldest numerical algorithms was described by the greek mathematician, euclid, in 300 b.c. it is a simple but very eā†µective algorithm that computes the greatest common divisor of two given integers. for instance, given integers 24 and 18, the greatest common divisor is 6, because 6 is the largest integer that divides evenly into both 24 and 18. we will denote the greatest common divisor of x and y as gcd(x, y). the algorithm is based on the clever idea that the gcd(x, y) = gcd(x ! y, y) if x > = y and gcd(x, y) = gcd(x, y ! x) if x < y. the algorithm consists of a series of steps (loop iterations) where the ā€œlargerā€ integer is replaced by the diā†µerence of the larger and smaller integer. this continues until the two values are equal. that is then the gcd.
Answers: 3
question
Computers and Technology, 23.06.2019 02:30
Experimental data that is expressed using numbers is said to be
Answers: 1
question
Computers and Technology, 23.06.2019 07:30
What is the penalty for violating section 1201 of title 17 chapter 21 of the us code
Answers: 1
You know the right answer?
We consider a 201-threaded process with multiple phases. Whenever a thread finishes a phase, it will...
Questions