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

Problem 3 (3 Pts) Compilers can have a profound impact on the performance of an

ID: 3752737 • Letter: P

Question

Problem 3 (3 Pts) Compilers can have a profound impact on the performance of an application. Assume that for a program, compiler A results in a dynamic instruction count of 10 and has an execution time of 1.1 s, while compiler B results in a dynamic instruction count of 1.2 109 and an execution time of 1.5 s Find the average CPI for each program given that the processor has a clock cycle time of 2 ns. Compiler A (1 pt Compiler B (1 pt) (1 pts) Assume the compiled programs run on two different processors. If the execution times on the two processors are the same, how much faster is the clock of the processor running compiler A's code versus the clock of the processor running compiler B's code (in other words what is the ratio )?

Explanation / Answer

we have to find the clock cycles per instruction.

a. time taken for execution = 1.1 sec and clock time period= 2 ns.

so total no. of clocks cycles used = (1.1 / 2 ) * 109 = 0.55 * 109.

now instruction count= 1 * 109 . so CPI= 0.55 / 1 = 0.55 cycles per instruction.

b. For B,

time taken for execution = 1.5 sec and clock time period= 2 ns.

so total no. of clocks cycles used = (1.5 / 2 ) * 109 = 0.75 * 109.

now instruction count= 1.2 * 109 . so CPI= 0.75 / 1.2 = 0.625 cycles per instruction.

2. Now execution time= no. of clock cycles * clock time period

so the ratio of clock time period = t1/ t2 = inverse of ratio of clock cycles used by both processes

so t1/t2 = 0.75/0.55= 1.36 . So , time period of process A is 1.36 times greater than process B which implies that frequency of B is 1.36 times greater, hence B is 1.36 times faster than A or A is 0.735 times faster than B.

This makes sense because, if we equal the time for both processes, A has to process less no. of clock cycles than B and hence has to be slower.  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote