In: Computer Science
For a given CPU, the cycle latency for a set of operations are given as follows:
Addition: 4
Subtraction: 8
Multiplication: 64
Division: 80
If the clock of this CPU runs at 3GHz, find the following
How many operations of each of the list above can this CPU perform in 5 minutes?
If we have a set of operations that contains 10^9 of each operation in the list in part 1, compute the required time in seconds to execute the set. Please explain the formula used.
A CPU frequency of 3 GHz means that the CPU runs (3 * 109) cycles per second.
Thus, the number of instructions of a particular type that can be run in a second
= (Number of CPU cycles per second) / (Number of cycles for the particular instruction type)
Thus, the number of instructions of a particular type that can be run in 5 minutes (300 seconds)
= [300 * (Number of CPU cycles per second)] / (Number of cycles for the particular instruction type)
Thus, number of instructions in 5 minutes for
Addition :
= [300 * (3 * 109)] / 4
= (225 * 109) additions
Subtraction :
= [300 * (3 * 109)] / 8
= (112.5 * 109) subtractions
Multiplication :
= [300 * (3 * 109)] / 64
= (14.0625 * 109) multiplications
Division :
= [300 * (3 * 109)] / 80
= (11.25 * 109) divisions
Now, if we are given number of instructions, then execution time (in seconds)
= [(Number of instructions) * (Cycles per instruction type)] / (Number of CPU cycles per second)
Since we are given that there are 109 operations of each kind, so the total time (in seconds) for
Addition :
= [109 * 4)] / (3 * 109)
= 1.333 seconds
Subtraction :
= [109 * 8)] / (3 * 109)
= 2.667 seconds
Multiplication :
= [109 * 64)] / (3 * 109)
= 21.333 seconds
Division :
= [109 * 80)] / (3 * 109)
= 26.667 seconds
Thus, total execution time (in seconds) for the set
= 1.333 + 2.667 + 21.333 + 26.667
= 52 seconds