subject

Considering the following algorithm, which of the following requirements are satisfied?
int currentthread = 1;
bool thread1access = true;
bool thread2access = true;
thread1 { thread2 {
while (true) { while (true) {
while(thread2access == true) { while(thread1access == true) {
if (currentthread == 2) { if (currentthread == 1) {
thread1access = false; thread2access = false;
while (currentthread == 2); while (currentthread == 1);
thread1access = true; thread2access = true;
} }
/* start of critical section */ /* start of critical section */
currentthread = 2 currentthread = 1

/* end of critical section */ /* end of critical section */
thread1access = false; thread2access = false;

} }
} }
} }

a) mutual exclusion
b) bounded waiting
c) progress
d) none of the above

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:20
This problem has been solved! see the answeran evil king has a cellar containing n bottles of expensive wine, and his guards have just caught a spy trying to poison the king’s wine. fortunately, the guards caught the spy after he succeeded in poisoning only one bottle. unfortunately, they don’t know which one. to make matters worse, the poison the spy used was very deadly; just one drop diluted even a billion to one will still kill someone. even so, the poison works slowly; it takes a full month for the person to die. design a scheme that allows the evil king to determine exactly which one of his wine bottles was poisoned in just one month’s time while expending at most o(logn) of his taste testers.you are not allowed to use n testers, one for each bottle, and see which one tester dies after 30 days.(no pseudocode needed. just answer in words, how many testers you use, how you use them and why you correctly identify the poisoned bottle in 30 days)
Answers: 2
question
Computers and Technology, 22.06.2019 06:30
This technology is used to produce high-quality documents that look good on the computer screen and in print.
Answers: 1
question
Computers and Technology, 22.06.2019 19:10
How might the success of your campaign be affected if you haven’t carefully completed all field data or if you accidentally insert the wrong merge field in the document?
Answers: 1
question
Computers and Technology, 22.06.2019 19:30
When creating a presentation in libre office impress, where does the editing of slides take place?
Answers: 1
You know the right answer?
Considering the following algorithm, which of the following requirements are satisfied?
int c...
Questions
question
Mathematics, 13.12.2021 18:50
question
Mathematics, 13.12.2021 18:50
Questions on the website: 13722361