You have learned in class that if process A and process B share the same memory
ID: 3836281 • Letter: Y
Question
You have learned in class that if process A and process B share the same memory with data = 100, and A tries to add 1 to that data, while B tries to add 2 to that data, then the outcome can be 103 (= 100 + 1 + 2 or = 100 + 2 + 1) in the normal case or 101 or 102 in the abnormal or error case.
Now consider four processes A, B, C, and D sharing data = 100, trying to add by 1, 2, 3, and 4 respectively
a) How many possible outcomes are there, including correct ones and incorrect ones?
b) List all of them.
c) Is 115 a possible outcome? Is that a correct outcome? How many are there? List all of them.
d) Is 116 a possible outcome? Is that a correct outcome? How many are there? List all of them.
e) Is 104 a possible outcome? Is that a correct outcome? How many are there? List all of them.
Explanation / Answer
a) & b) Possible outcomes:15
Correct : 100 + 1 + 2 +3 + 4 = 110
Incorrect can be : 101, 102, 103, 104, 103, 104, 105, 105, 106, 107, 106,107, 108,109
c) No
d) No
e) Yes : It is incorrect outcome. It can come twice.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.