subject

In the following code, use a lock to protect any data that might need protecting. Keep your critical sections as small as possible. (10%) int flag = 0; int a = 0; void thread_a(){ a += 2; Flag = 1; } 1 void thread_b(){ int b = 0; if (flag) { b++; } b += 3; a -= b; }

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:10
David is in week 3 of his current ashford course and has a paper due by monday night at midnight. he has finished everything but the concluding paragraph. as he boots up his computer to work on it, he sees a flash across the screen and then the screen goes black. he begins to panic as he tries desperately to turn the laptop back on. david should have saved his work on what kind of portable device?
Answers: 2
question
Computers and Technology, 22.06.2019 23:30
Which of the following is not a symptom of chronic fatigue syndrome
Answers: 2
question
Computers and Technology, 23.06.2019 01:30
In deadlock avoidance using banker’s algorithm, what would be the consequence(s) of: (i) a process declaring its maximum need as maximum possible for each resource. in other words, if a resource a has 5 instances, then each process declares its maximum need as 5. (ii) a process declaring its minimum needs as maximum needs. for example, a process may need 2-5 instances of resource a. but it declares its maximum need as 2.
Answers: 3
question
Computers and Technology, 23.06.2019 16:30
What is one reason why indoor air pollution has become an increasing problem.
Answers: 1
You know the right answer?
In the following code, use a lock to protect any data that might need protecting. Keep your critical...
Questions
question
Mathematics, 28.04.2021 21:30
question
English, 28.04.2021 21:30
question
Mathematics, 28.04.2021 21:30
question
Mathematics, 28.04.2021 21:30
Questions on the website: 13722367