In: Computer Science
Two processes share the variable "I". Process A increments it 10 times and process B decrements it 25 times without using critical sections. The initial value of I is 0. The final value of I MUST be
Please explain.
ANSWER : HERE IS THE ANSWER FOR YOUR QUESTION:
------------------------------------------------------------------------------------------------------
here we are given 2 processes as A and B which do not execute the critical section area .
so these will be not be synchronized , so will be executed in the one by one manner . first
process A will be executed and then process B will be executed .
initially , the value of I is 0 .
now , the process A increments value OF I 10 times .. so the final value of I after Process A finishes will be 10
after this , process B start to execute and then it decrement the value by 25 . so the value will become as 10-25=-14
so , the final value of the I would be -14 as 0 value would also be reached
thus , the final value is -14
-------------------------------------------------------------------------------------------------------
I hope this would help you out.
If you like my answer , please upvote
If you have any doubt, you can provide comment /feedback below the answer
Thanks