This is the 21st day of my participation in Gwen Challenge
The title
If there are two benchmark programs P1 and P2 running on machine M1 and M2, assuming that the prices of M1 and M2 are 5000 yuan and 8000 yuan respectively, the table below shows the time and instruction number spent by P1 and P2 on M1 and M2.
Please answer the following questions:
(1) For P1, which machine has the fastest speed? How much faster? What about P2?
(2) What MIPS are the speeds of P1 and P2 on M1? What are the execution speeds on M2?
In terms of execution speed, which machine is faster for P2? How much faster?
(3) Assuming that the clock frequency of M1 and M2 is 800MHz and 1.2ghz respectively, what is the average number of clock cycles CPI when P1 is executed on M1 and M2?
(4) If a user needs to use program P1 in large quantities, and the user is mainly concerned with the response time of the system rather than throughput rate, should the user choose M1 or M2 when he needs to build a large number of machines? Why is that? (Hint: Consider the value for money)
(5) If another user also needs to purchase a large number of machines, but the user uses P1 as much as P2 and is mainly concerned with response time, should he choose M1 or M2? Why is that?
Topic answer
(1) For P1, M2 is 5000ms, while M1 is 10000ms, M2 is twice faster than M1; For P2, M1 is 3ms and M2 is 6ms, so M1 is twice as fast as M2.
(2) MIPS = number of instructions contained in the program/CPU execution time
For M1, the velocity of P1 is: 200M/10=20MIPS; P2 is 0.3 M / 0.003 = 100 MIPS
For M2, the velocity of P1 is: 150M/5=30MIPS; P2 is 0.42 M / 0.006 = 70 MIPS
In terms of execution speed, for P2, M1 is 0.43 times faster than M2 because 100/70=1.43 times.
(3) CPI = CPU execution time/(total number of program instructions * clock cycle)
The average number of clock cycles (CPI) when P1 is executed on M1 is 10x800M/(200×106)=40
The average number of clock cycles CPI for executing P1 on M2 is: 5×1.2g /(150×106)=40
(4) Consider the cost performance of M1 and M2 when running P1, because the user is mainly concerned with the response time of the system. Therefore, the performance in the cost performance considers the execution time, which is the reciprocal of the execution time. Therefore, cost-effective R is: R=1/ (execution time x price)
The larger R is, the higher the cost performance ratio is. In other words, the smaller the value of “execution time x price” is, the higher the cost performance ratio is. Because 10×5000 > 5×8000, so, M2 cost-effective. M2 should be chosen.
(5) P1 and P2 need to be considered equally. There are many ways of performance: summation of execution time, arithmetic average, geometric average. If arithmetic average method is used, then: because, (10+0.003)/2×5000 > (5+0.006)/2×8000, therefore, M2 is cost-effective. M2 should be chosen.
If geometric average method is used, then: because SQRT (10×0.003)x5000 < SQRT (5×0.006)x8000, therefore, M1 is cost-effective, M1 should be selected.