4
MIS 6010: IT INFRASTRUCTURE ASSIGNMENT #2 Given on: 6 th March 2015 Due: 20 th March 2015 Lecturer: Dr. G. Chege ([email protected]; Answer all Questions. Question #1 A pitfall, related to the execution of programs in multiprocessor systems, is expecting improvement in performance by improving only the execution time of part of the routines. The following table shows the execution time of five routines of a program running on different numbers of processors (case (a) and case (b)). No. 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

MIS 6110 Assignment #2 (Spring 2015)

Embed Size (px)

DESCRIPTION

Mis solutions for assignments

Citation preview

Page 1: MIS 6110 Assignment #2 (Spring 2015)

MIS 6010: IT INFRASTRUCTURE ASSIGNMENT #2 Given on: 6th March 2015 Due: 20th March 2015

Lecturer: Dr. G. Chege ([email protected];

Answer all Questions.

Question #1

A pitfall, related to the execution of programs in multiprocessor systems, is expecting improvement in performance by improving only the execution time of part of the routines. The following table shows the execution time of five routinesof a program running on different numbers of processors (case (a) and case (b)).No.

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 forthe 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 thiscase, the routing time is an important component of the total time.

Page 2: MIS 6110 Assignment #2 (Spring 2015)

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:

T improved=T affected

improvement factor+T unaffected

Example: Multiply accounts for 80s out of a total of 100s computation timeHow much improvement in multiply performance required to get 5× overall?

T improved = 100s/5 = 20s;T affected = 80s;T unaffected = 100s -80s = 20s ;Improvement factor = n;

Hence,

Hence, can’t be done!

Question #3 The following table holds some C code for two problems (a & b). You will be required to evaluate these C code statements in MIPS assembly code.

20=80n

+20

Page 3: MIS 6110 Assignment #2 (Spring 2015)

a) for (i=0; i < a; i++) 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 differentMIPS 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.

Page 4: MIS 6110 Assignment #2 (Spring 2015)

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?