Question: a ) Given the following program in which two threads concurrently update one critical resource shared _ data without using locks, theoretically, how many different

a) Given the following program in which two threads concurrently update one critical resource shared_data without using locks, theoretically, how many different final values may shared_data have? Please explain how each different value is attained by showing the running order of the two functions (e.g., running order of statements of 8,9,11 and 16,17,19).(b) Given the following program in which two threads concurrently update one critical resource shared_data, how should you change the program by adding appropriate lock(s) in order to make the execution result correct (i.e., same as running the two threads serially)?

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 Programming Questions!