169k views
5 votes
Suppose a computer executes a program where the program contains 20% of the load instruction, 30% arithmetic instruction, 30% branch instruction and 20% store instruction. Assuming all the instructions take same amount CPI, Compiler 1 is targeted to make arithmetic instruction to run 4 times faster than the present compiler and Compiler 2 is targeted to make load instruction to run 6 times faster. Compiler 3 is targeted to make store instruction to run 7 times faster. a). Which compiler would you choose to purchase as the best compiler and gives highest performance as No.1? b). Which compiler would be the second highest performance (No.2)?

User AlexisG
by
7.3k points

1 Answer

5 votes

Final answer:

Given the percentages of instruction types, Compiler 1 would provide the highest performance due to the 4 times speed increase for arithmetic instructions. Compiler 3 would be the second highest performance with 7 times speed increase for store instructions.

Step-by-step explanation:

If we assume all instructions have the same cycles per instruction (CPI) and that improving the speed of an instruction type linearly increases the performance for that instruction type, then we can calculate the relative performance enhancements provided by each compiler. Suppose the original compiler has a performance of 1 unit. The arithmetic instructions, which make up 30% of the instructions, can be executed 4 times faster with Compiler 1. Hence this would provide a performance increase for 30% of the instructions, essentially contributing to a 30% overall speed increase. Similarly, Compiler 2 makes load instructions, which make up 20% of the instructions, 6 times faster, which is a 20% overall speed increase. Compiler 3, on the other hand, makes store instructions (also 20% of the instructions) 7 times faster, which is also a 20% overall speed increase.

Based on this information, Compiler 1 would provide the highest performance, and Compiler 3 would be the second highest performance since the store instruction speed increase edges out the load instruction speed increase due to the specific percentages of instruction types given.

User Diegocr
by
7.8k points