COMP3370TermTests_2019_SampleSolnsRevised.pdf - Possibly Useful Equations CPI= ∑ CPI(i fraction(i where i is an instruction type and fraction(i is the

COMP3370TermTests_2019_SampleSolnsRevised.pdf - Possibly...

This preview shows page 1 - 3 out of 9 pages.

Possibly Useful Equations: where i is an instruction type and fraction(i) is the fraction of i type instructions in a program. [3] In the last formula given on the preceding page, concisely explain what the three terms on the right hand side are. “Affected” is the part of the program that is planned to be improved. “Unaffected” is the rest of the program. “Amount of improvement” – factor by which the affected part is improved. [3] In the second formula given on the preceding page, explain what the three terms on the far right hand side are. IC (Instruction Count) is the number of instructions executed when running a program . CPI (Clocks Per Instruction) is the average number of cycles required to execute an instruction . Clock Rate is the number of clock cycles per second. [3] In the first formula given on the preceding page, explain where the three terms on the right hand side come from. 1. “Inst/Program” comes from (is determined by) the program (software) characteristics [an architecture (ISA) concern] 2. “seconds/cycle” comes from (is determined by) the machine (hardware) characteristics [an implementation concern] 3. “cycles/instruction” comes from the interface between the instruction set architecture (ISA) and implementation linking the other two terms. [3] A program has four types of instructions, T 1 through T 4 . The number of cycles required for each instruction type on two different processors, P 1 and P 2 , are given in Table 1 below. The clock rate of the two processors P 1 and P 2 are 2 GHz and 1 GHz, respectively. Assuming that instructions in the program are equally distributed among the different instruction types, answer the following questions: a. [1] What is the average CPI for this program on P 1 ? Assuming equal distribution of instruction types (as given) we simply sum the individual CPIs for each type of instruction and divide by the number of types. In this case 3+4+4+5=16 so CPI for P1 is 16/4=4. CPI = CPI ( i )* fraction ( i ), Exe . time after improvement = Exe . time unaffected + Exe . time affected Amount of improvement CPI for P 1 CPI for P 2 T 1 5 4 T 2 4 3 T 3 4 3 T 4 3 2 Table 1
Image of page 1
b. [1] What is the average CPI for this program on P 2 ? In this case 4+3+2+3=12 so CPI for P2 is 12/4=3 c. [1] Which machine will run the program faster and by how much (a ratio is fine)? Execution time = ICxCPIxCycleTime or ICxCPI/ClockRate. To determine which runs faster, we would be comparing the run time for a single program on both machines meaning the instruction count would be identical so IC can be ignored. Similarly, the clock rate for both machines is given in GHz so we can ignore the GHz. Thus, the “generic time” (GT) for the processors are GT(P1)=4/2=2 and GT(P2)=3/1=3. Thus, P1 will run the program faster than P2. Specifically, it will run the program 1.5 times as fast so there is a 50% speed difference.
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 9 pages?

  • Spring '17

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors