Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider two machines, machine A and machine B. Machine B runsfloating-point ins

ID: 3616460 • Letter: C

Question

Consider two machines, machine A and machine B. Machine B runsfloating-point instructions 5 times faster than machine A.

(i) Consider a program that takes 10 seconds to run on machineA, and spends half its time in floating-point instructions. Howmuch faster is machine B (over machine A) at executing thisprogram?

(ii) Suppose we want a benchmark program to run 3 times fasteron machine B than it runs on machine A. What fraction of its timedoes it spend executing floating point instructions on machine A?What fraction of its time does the same program spend executingfloating-point instructions on machine B?

Explanation / Answer

a) assuming that for instructions other than floating-point, A andB will take the same time. A takes 10 seconds for the program, therefore it takes 5 secondsfor floating point instructions and 5 seconds for otherinstructions. As B is 5 times faster for floating- point instructions it willtake 5/5 = 1 second for floating point instructions Therefore total time taken by B = 1 second (floating point) + 5seconds (other instructions)                                              = 6seconds Therefore b is 10/6 = 5/3 times faster than A b) let the benchmark program takes Tf time for executingfloating point instructions on B and To for executingotehr instructions on B Therefore time taken by benchmark program on B = Tf +To It takes 5Tf + To on A It is given that benchmark program is 3 times faster on B thanA Therefore      3(time on B) = time on A     3(Tf + To) =5Tf +To        2To = 2Tf     => To = Tf Therefore half of the time is spent on executing floating-pointinstructions on B [since Tf = To]