Question

Suppose threads A and B are attempting to lock at the same time. Assume that there...

Suppose threads A and B are attempting to lock at the same time. Assume that there is a single shared variable. Let the value of 0 mean that no object is in the CS. Assume that a value of 1 in this variable indicates that A is entering/is in the CS and a value of 2 in the same register indicates that B is entering/is in the CS. Assume that A and B both read the register, initially 0, and are about to update them. Suppose A updates the register to 1. What would be the result? Select all that apply.

  1. A will enter the CS.
  2. The two threads will deadlock.
  3. B will wait for A to complete the execution of the CS.
  4. B will eventually obliterate the value written by A.
  5. The lock object will be in an inconsistent state.
  6. Both A and B could be in the CS at the same time.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

A and B both read the register, initially 0, and are about to update them. Suppose A updates the register to 1.
(1)A will enter the CS.
(2)B will eventually obliterate the value written by A.
(3)Both A and B could be in the CS at the same time.

Add a comment
Know the answer?
Add Answer to:
Suppose threads A and B are attempting to lock at the same time. Assume that there...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT