Please answer question two Thank you 1 The following shows t
Please answer question two. Thank you.
1) The following shows two threads, Thread A and Thread B, to be run on superscalar machine with 2 slots. Assume that before the code is run a, b, x and y are 0. Show how each would execute on Fine-Grained Multithreading. What are values of a, b, x and y at the end of Fine MT completion? Thread A Time Thread B Al A2 B1 182 A3 3 A4 B3 B4 ASA A7 A2: a b+7 B2: x at y A4: a Exty a +7 A5: xt-5 A6: as y+7 A7: bay bSolution
a) core 1 scheduled first followed by core 2
Thread A:
A1: x = y+5 , x=5
A2: a = b+7 , a = 7
A3: y = x*a, y = 35
A4: a= x+y, a = 40
A5: x +=5 , x = 10
A6: a = y+7 , a = 42
A7: b = y+b , b = 35
Core 2, Thread B
B1: a = y+3 , a = 38
B2: x = a+y, x = 77
B3: x = b+7, x = 42
B4: y = a+7, y=45
b) core 2 scheduled first followed by core 1
Core 2, Thread B
B1: a = y+3 , a = 3
B2: x = a+y, x = 3
B3: x = b+7, x = 7
B4: y = a+7, y=10
Thread A:
A1: x = y+5 , x= 15
A2: a = b+7 , a = 7
A3: y = x*a, y = 105
A4: a= x+y, a = 120
A5: x +=5 , x = 20
A6: a = y+7 , a = 112
A7: b = y+b , b = 105

