PS1 Exercises
PS1 Exercises
Problem Session #1
23/10/2023
Prepared by: Res. Asst. Sibel Gülmez
Computer Performance: Clock Cycle
Time
Computer Performance: Vocabulary
CPU Time: The time period CPU requires to complete a task.
Clock Rate (or Clock Speed): The number of clock cycles per
second.
CPI (Cycle per Instruction): The number of clock cycles the CPU
needs to execute an instruction.
Computer Performance: Formulas
Clock Cycle Time = 1 / (Clock Rate)
Answer:
500 MHz CR means that the CPU can execute 500 * 10^6 clock cycles per second.
Computer Performance: Example 1
Question:
- CPU clock rate is 500 MHz
- Program takes 45 million cycles to execute
What’s the CPU time?
Answer:
500 MHz CR means that the CPU can execute 500 * 10^6 clock cycles per second.
Answer:
500 MHz CR means that the CPU can execute 500 * 10^6 clock cycles per second.
Answer:
500 MHz CR means that the CPU can execute 500 * 10^6 clock cycles per second.
Unit of Measure?
Computer Performance: Example 1
Question:
- CPU clock rate is 500 MHz
- Program takes 45 million cycles to execute
What’s the CPU time?
Answer:
500 MHz CR means that the CPU can execute 500 * 10^6 clock cycles per second.
Unit of Measure?
Answer:
CPU Time (A) = 0,600*10^-7 seconds
CPU Time (B) = 0,825*10^-7 seconds
Computer Performance: Example 3
Question: Assume Program A is being executed on a 500 MHz CPU and Program B
on a 400 MHz CPU. Calculate which Program is faster and how much faster?
Instruction Type R Type I Type J Type
CPI 4 3 2
Program A 5 Instructions 2 Instructions 2 Instructions
Program B 2 Instructions 5 Instructions 5 Instructions
Answer:
CPU Time (A) = 0,600*10^-7 seconds
CPU Time (B) = 0,825*10^-7 seconds
Answer:
CPU Time (A) = 0,600*10^-7 seconds
CPU Time (B) = 0,825*10^-7 seconds
CPU Time (A) / CPU Time (B) = (0,600*10^-7 seconds) / (0,825*10^-7 seconds)
Computer Performance: Example 3
Question: Assume Program A is being executed on a 500 MHz CPU and Program B
on a 400 MHz CPU. Calculate which Program is faster and how much faster?
Instruction Type R Type I Type J Type
CPI 4 3 2
Program A 5 Instructions 2 Instructions 2 Instructions
Program B 2 Instructions 5 Instructions 5 Instructions
Answer:
CPU Time (A) = 0,600*10^-7 seconds
CPU Time (B) = 0,825*10^-7 seconds
CPU Time (A) / CPU Time (B) = (0,600*10^-7 seconds) / (0,825*10^-7 seconds)
~0,7273
Computer Performance: Example 3
Question: Assume Program A is being executed on a 500 MHz CPU and Program B
on a 400 MHz CPU. Calculate which Program is faster and how much faster?
Instruction Type R Type I Type J Type
CPI 4 3 2
Program A 5 Instructions 2 Instructions 2 Instructions
Program B 2 Instructions 5 Instructions 5 Instructions
Answer:
CPU Time (A) = 0,600*10^-7 seconds
CPU Time (B) = 0,825*10^-7 seconds
CPU Time (A) / CPU Time (B) = (0,600*10^-7 seconds) / (0,825*10^-7 seconds)
~0,7273