Question: Note that process switch actually may happen after each instruction. Consider the following pseudo code. int a = 5: XO . load a; add -1;

Note that process switch actually may happen after each instruction. Consider the following pseudo code.

int a = 5:

XO

. load a;

add -1;

store a;

load a; add 3; store a;

10 points

Save Answer

}

main()

create-thread (execute function X);

create-thread (execute function X);

wait for threads to finish;

print a

Give all the possible values that may be printed by the above program. Give the values in numerical order, separated by comma with no space (e.g., 1,2,5, 15).

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!