Homework 4

  1. Page 55 1.4
    Assume a color display using 8 bits for each color per pixel and a 
    frame size of 1280 x 1024.  
    
    a. What is the minimum size in bytes of the fram buffer to store a frame?
    
    1280 x 1024 pixels x 3 colors / pixel x 8 bits/ color = 31,457,280 bits.
         31,457,280 bits x 1 byte/8 bits = 3,932,160 bytes.
         4 MB
    
    b. How long would it take, at a minimum, for a frame to be sent over
    a 100 Mb/sec network
    
        31,457,280 bits x 1 second/100x106 bits = .31 seconds.
       
  2. 1.5 page 55
     
    Consider three different processors P1, P2, and P3 executing the 
    same instruction set. 
        P1 has a 3.0 GHz clock and a CPI of 1.5
        P2 has a 2.5 GHz clock and a CPI of 1.0
        P3 has a 4.0 GHz clock and a CPI of 2.2
    
       (a) Which process has the highest performance expressed in 
           instructions per second.
    
        1 instruction/ C cycles x  n cycles/ 1 second = n/c instructions/second
    
        P1:   3.0/1.5 x 109 instructions = 2.0 Ginstructions
        P2:   2.5/1.0 x 109 instructions = 2.6 Ginstructions
        P3:   4.0/2.2 x 109 instructions = 1.8 Ginstructions
    
        P2 has a higher instruction per second value so it is faster, assuming
        all three are running the same program with the same instruction mix.
    
        (b) If the processors each execute a program in 10 seconds, find the 
           number of cycles and instructions.
    
         i instructions/ sec x 10 seconds = 10i instructions
    
         10i instructions x c cycles/instruction = 10i × c cycles.
    
         P1: 2.0x109 x 10  = 20x109 instructions
         P2: 2.6x109 x 10  = 26x109 instructions
         P3: 1.8x109 x 10  = 18x109 instructions
    
         P1: 20x109 x 1.5 = 30 x 109cycles
         P2: 26x109 x 1.0 = 26 x 109cycles
         P3: 18x109 x 2.2 = 40 x 109cycles
       
  3. 1.6
          P1: .1 x 1 + .2 x 2 + .5 x 3 + .2 x 3 = 2.6 CPI
          P2: .1 x 2 + .2 x 2 + .5 x 2 + .2 x 2 = 2.0 
    
          1.0 x 106 instructions x c cycles/instruction = c x 106 cycles.
    
          P1: 2.6 x 106 cycles
          P2: 2.0 x 106 cycles
       
  4. 1.12
    
      Start off by computing the time for each to perform the computation.
    
      i instructions x c cycles/instruction x 1 second/ k x 109 cycles
         = ic/k  x 10-9 seconds
    
         P1: i = 5x109               P2:   i = 1.0x109
             k = 4  (GHz)                  k = 3  (GHz)
    	 c = 0.9                       c = 0.75
    
    	 5 x 0.9/4 = 1.125 sec          1x0.75/3 =.25 sec
    
    	 P2 is clearly faster due to the low instruction count and other
    	 factors being nearly the same.
    
         (a) in spite  of P1 having the faster clock, it is not the faster machine
             for this program
    
         (b) 1.0 x 109 instructions x 0.9 cycles/instruction x 1 second/4.0x109 cycles 
              = 1x0.9/4 seconds
    	  =  0.225 seconds
    
    	 0.225 seconds = n x109instructions x 0.75 cycles/instruction x 1 second/3x109 cycles
    	 0.225 seconds = nx0.75/3 
    	 n = 0.225/0.75 x 3
    	   = .9
    	 It would require 9x108 instructions.
    
    
         (c)  MIPS
                  Assume the conditions of the original problem.
    
    	  k x 109 instructions / s seconds x 1 million instructions/ 106 instructions
    	    = k/s x 103 MIPS
    
    	         = 5/1.125 x 103 MIPS
    		 = 4.4x103 MIPS
    
    	  P1:  5/1.125 x 103 MIPS = 4.4x 103 MIPS
              P2: 1.0/.25 x 103 = 4 x 103 MIPS.
    
    	  P2 has a lower mips rating, but is faster.
    
        (d) flops is the SAME computation with only 40% of the instructions.
              P1: 1.76 x 103 Mflops
    	  P2: 1.6 x 103 Mflops.