Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The initial value of x is not given Assume three threads, A, B, and C, with two instructions each, as shown in Figure 1. Thread
The initial value of x is not given
Assume three threads, A, B, and C, with two instructions each, as shown in Figure 1. Thread A Thread B 1B1 : x =x-2 IB2 print (x) Thread C 1C1 : x = x+2 IC2 print (x) IA2 print (x) Figure 1: Three Threads, with two instructions each All three threads are sharing the integer variable x, and the instruction pipeline on the computer where these threads are concurrently executed contains fetch, execute, and write back stages As a first step, rewrite the instructions for the threads into a register/ALU view (as was shown in lecture). For the update, each thread fetches the value of x into a private (non-shared) memory space, and the write back stage writes to the shared variable. Assume that the print instruction of each thread cannot be decomposed further and the x used by a print is the value of the shared x Under these conditions, which of the following outputs (output to the screen) are possible when all three threads run to completion? If the output is NOT possible, then explain why. If the output IS possible, then provide the order of execution of the register/ALU instructions. A. 121 B. 222 C. 323 D. 432 E. 536 F. 55 G. 789 Assume three threads, A, B, and C, with two instructions each, as shown in Figure 1. Thread A Thread B 1B1 : x =x-2 IB2 print (x) Thread C 1C1 : x = x+2 IC2 print (x) IA2 print (x) Figure 1: Three Threads, with two instructions each All three threads are sharing the integer variable x, and the instruction pipeline on the computer where these threads are concurrently executed contains fetch, execute, and write back stages As a first step, rewrite the instructions for the threads into a register/ALU view (as was shown in lecture). For the update, each thread fetches the value of x into a private (non-shared) memory space, and the write back stage writes to the shared variable. Assume that the print instruction of each thread cannot be decomposed further and the x used by a print is the value of the shared x Under these conditions, which of the following outputs (output to the screen) are possible when all three threads run to completion? If the output is NOT possible, then explain why. If the output IS possible, then provide the order of execution of the register/ALU instructions. A. 121 B. 222 C. 323 D. 432 E. 536 F. 55 G. 789Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started