Question: Programmer's intuition means (i) that instructions execute in program order, and (b) that memory accesses are atomic. (a) Assume two processors are executing following

"Programmer's intuition" means (i) that instructions execute in program order, and (b) 

"Programmer's intuition" means (i) that instructions execute in program order, and (b) that memory accesses are atomic. (a) Assume two processors are executing following code. Initial values of vand u are zero. P1 al: v= 10; a2: v available = 1; a3: if (u_available == 1) print u; P2 a4: if (v_ available u = v*10; a5: u available = 1; a6: print v; == 1) For this part, do not assume that the instructions of P1 and P2 have to execute in order (e.g., a6 can be executed before a 4). What are all possible combinations for printing v and u? For each combination, state the sequence of instruction executions (e.g., ala2 a3 a4 a5 a6). (b) of the above results, which combination(s) of (v, u) is correct according to programmer's intuition? (c) The other results are impossible according to programmer's intuition. Which of the following is not followed in producing these results, program-order execution or atomicity of memory operations?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a Assuming that the instructions of P1 and P2 can execute out of order the possible combinations for ... View full answer

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!