Machine M has a clock whose period is 4 nanoseconds and three types of instructions – type A instructions that take 4 cycles to execute, type B instructions that take 4 clock cycles to execute, and type C instructions that take 2 clock cycles to execute. Program P consists of 30 instructions of type A, 25 instructions of type B, and 50 instructions of type C. What is the execution time of program P?
Number of cycles required to execute program P = number of instructions of type A * number of cycles required to complete 1 A instruction + number of instructions of type B * number of cycles required to complete 1 B instruction + number of instructions of type C * number of cycles required to complete 1 C instruction
= 30 * 4 + 25 * 4 + 50*2
= 120 + 100 + 100
= 320 cycles
Required execution time = Number of cycles required to execute program P * 1 cycle time
= 320 * 4 ns
= 1280 ns
= 1280 * 10-9 s
= 1.280 microseconds
So, execution time of program P = 1280ns = 1.28 microseconds
Get Answers For Free
Most questions answered within 1 hours.