Question: We modify the pseudo code in the previous question to create the same thread 5 times. int a = 5; X() { load a; add
We modify the pseudo code in the previous question to create the same thread 5 times.
int a = 5; X() { load a; add -1; store a; load a; add 3; store a; } main() { create-thread (execute function X); create-thread (execute function X); create-thread (execute function X); create-thread (execute function X); create-thread (execute function X); wait for threads to finish; print a; } (a) What is the minimal value that may be printed by the above program? (b) What is the maximal value that may be printed by the above program?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
