Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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. 789

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions

Question

Differentiate tan(7x+9x-2.5)

Answered: 1 week ago

Question

Explain the sources of recruitment.

Answered: 1 week ago

Question

Differentiate sin(5x+2)

Answered: 1 week ago

Question

Compute the derivative f(x)=1/ax+bx

Answered: 1 week ago

Question

Presentation Aids Practicing Your Speech?

Answered: 1 week ago