Question: Suppose that two threads A and B have access to the shared variable account , which has the initial value of 1 0 0 ;

Suppose that two threads A and B have access to the shared variable account, which
has the initial value of 100; Now, thread A is going to make a deposit and perform: account
= account +200, while thread B is going to do a withdraw: account = account 50.
1) What are the possible values of the variable after running the two threads without having
a synchronization mechanism for the critical section?
2) Use semaphore to address the critical section problem

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!