Assess your understanding of pipeline performance and cycles per instruction (CPI) calculations with these beginner-friendly questions. Strengthen your grasp of core processor concepts, including hazards, instruction throughput, and how design choices impact pipeline efficiency.
What does CPI represent in the context of computer pipelines?
Explanation: CPI stands for cycles per instruction, which measures the average number of clock cycles each instruction takes to execute. The other options are incorrect: 'Calculations per input' and 'Clock per increment' do not relate to standard CPU pipeline terminology, and 'Central processing indicator' is not a recognized performance metric in this context.
If a processor's pipeline increases from 5 to 10 stages without changing clock speed, what is the most likely immediate effect on instruction latency?
Explanation: Adding more pipeline stages typically increases instruction latency, as each instruction passes through more stages to complete execution. Throughput may improve due to increased parallelism, but instruction latency is about how long one instruction takes. Throughput halving is incorrect, and additional stages do not eliminate pipeline hazards; they often make hazard handling more complex.
In a perfectly balanced 4-stage pipeline, what is the maximum throughput after the pipeline is filled?
Explanation: Once the pipeline is filled, a balanced pipeline can complete one instruction per clock cycle. '4 instructions per cycle' and '2 instructions per cycle' overstate the throughput, while '0.25 instructions per cycle' suggests the pipeline is not full or there are other delays, which is incorrect for an ideal filled pipeline.
If a pipeline must stall every fifth cycle due to a hazard, how will this affect the average CPI?
Explanation: Stalling introduces extra cycles without completing new instructions, increasing the average cycles per instruction (CPI) above 1. The CPI cannot remain at 1 if stalls occur, cannot drop below 1 for a classic pipeline, and cannot become zero, as that would imply no cycles are used.
Given two instructions where the second uses the result of the first, what hazard may occur in a pipeline?
Explanation: A data hazard arises when an instruction depends on the result of a previous instruction that has not yet completed. 'Code hazard' is not a standard term, 'memory overlap' refers to a different issue, and 'instruction fetch stall' is possible but is not specific to data dependencies.
If a processor executes 100 instructions in 120 cycles, what is the average CPI?
Explanation: CPI is calculated as total cycles divided by total instructions, so 120 divided by 100 equals 1.2. 0.83 is the inverse and incorrect, 120 is the number of cycles, and 100 is the number of instructions, not the CPI.
What is the typical effect of pipeline hazards on overall pipeline performance?
Explanation: Pipeline hazards such as data or control hazards often lead to pipeline stalls, reducing throughput and efficiency. Hazards cannot speed up execution or clock speed, and rather than eliminating dependencies, they occur because of existing dependencies.
What is the ideal CPI for a fully pipelined architecture with no hazards or stalls?
Explanation: In an ideal situation with no hazards or stalls, the pipeline can complete one instruction per cycle, giving a CPI of 1. A CPI of 0 or a negative value is not possible, and a CPI greater than 2 would indicate substantial inefficiency, which is not the ideal.
If a program has a mix of fast and slow instructions, how does this affect the overall CPI?
Explanation: The overall CPI is a weighted average determined by the frequency and cycle count of each instruction type. It does not become infinite, always drop to 1, or remain unchanged—instead, it varies depending on the program's instruction mix.
Which factor is least likely to directly improve pipeline performance?
Explanation: While a higher clock speed can quicken cycles, if stall frequencies remain high, performance gains are limited. Reducing pipeline stalls, balancing stage durations, and improving hazard detection all directly boost performance by keeping the pipeline running efficiently. Simply increasing clock speed does not resolve the underlying pipeline inefficiencies caused by frequent stalls.