Академический Документы
Профессиональный Документы
Культура Документы
ASSIGNMENT #2
Given on: 6th March 2015
(gchege@usiu.ac.ke;
i) Find the total execution time and by how much it is reduced if the time of
routines A, C, and E is improved by 15% for each case.
iii) How much is the total time reduced if routine B is improved by 10% for each
case?
iii) How much is the total time reduced if routine D is improved by 10% for each
case?
Question #2
Execution time in a multiprocessor system can be split into computing time for
the routines plus routing time spent sending data from one processor to another.
Consider the execution time and routing time given in the following table. In this
case, the routing time is an important component of the total time.
a) For each doubling of the number of processors, determine the ratio of new to
old computing time and the ratio of new to old routing time.
b) Find the computing time and routing time for a system with one processor.
Hint: Pitfall - Improving an aspect of a computer and expecting a proportional
improvement in overall performance is subject to Amdahl s law which states:
Timprov ed
Taf f ected
Tunaf f ected
improvemen t factor
Example: Multiply accounts for 80s out of a total of 100s computation time
How much improvement in multiply performance required to get 5 overall?
Timprov ed
= 100s/5 = 20s;
Taf f ected
= 80s;
Tunaf f ected
= 100s -80s = 20s ;
Improvement factor = n;
Hence,
80
20
20
n
a)
a +=b;
b) for (i=0; i < a; i++)
for (j=0; i<b; i++)
D[4*j] = i+j;
i) For the table above, translate the C code to MIPS assembly code for each case.
Assume that the values of a, b, i, and j are in registers $s0, $s1, $t0, and $t1,
respectively. Also, assume that register $s2 holds the base address of the array
D.
ii) How many MIPS instructions does it take to implement the C code in each case?
If the variables a and b are initialized to 10 and 1 and all elements of D are initially
0, what is the total number of MIPS instructions that is executed to complete the
loop?
Question #4
For these problems, the table holds MIPS assembly code fragments. You will be
asked to evaluate each of the code fragments, familiarizing you with the different
MIPS branch instructions.
i) For the loops written in MIPS assembly above, assume that the register $t1 is
initialized to the value 10. What is the value in register $s2 assuming the $s2 is
initially zero?
ii) For each of the loops above, write the equivalent C code routine. Assume that
the registers $s1, $s2, $t1, and $t2 are integers A, B, i, and temp, respectively.
iii) For the loops written in MIPS assembly above, assume that the register $t1 is
initialized to the value N. How many MIPS instructions are executed?