Processor Performance, Pipelining and Hazards Short Notes for GATE CS
Processor Performance, Pipelining and Hazards short notes for GATE CS: 5 study cards covering concepts, formulas, shortcuts and exam traps, plus solved practi
processor performance pipelining and hazards short notes
Quick Reference: Pipeline Timing Formulas
Quick Reference: Pipeline Timing
Metric
Formula
Notes
Cycle Time
Tcycle=max(ti)+tlatch
Determined by the slowest stage.
Total Cycles
Cycles=k+n−1
k stages, n instructions.
Total Time
Ttotal=(k+n−1)×Tcycle
Assumes no stalls or hazards.
Throughput
TP=Ttotaln
Instructions completed per unit time.
Speedup
S=TtotalTnon−pipe
Max ideal speedup is k.
Quick Reference: CPI and Speedup Formulas
Quick Reference: CPI and Speedup
Metric
Formula
Notes
Actual CPI
CPIactual=CPIideal+Avg Stalls
CPIideal is typically 1.
Avg Stalls
∑(Freqi×Penaltyi)
Weighted sum of all hazard penalties.
Clock Rate
f=Tcycle1
Ensure units match (e.g., GHz and ns).
Execution Time
Texec=Inst. Count×CPI×Tcycle
The fundamental performance equation.
Speedup
S=TpipeTnon−pipe
Always use actual times, not just stage counts.
Quick Reference: Dependencies and Forwarding
Quick Reference: Dependencies and Forwarding
Dependency
Type
Hazard in 5-Stage?
Resolution
RAW
True Data
Yes
Forwarding (0 stalls) or Stall (1 cycle for LOAD)
WAR
Name (Anti)
No
Naturally avoided by in-order execution
WAW
Name (Output)
No
Naturally avoided by in-order execution
Golden Rule: If the producer is an ALU instruction, forwarding yields 0 stalls. If the producer is a LOAD instruction, forwarding yields 1 stall.
2 more cards in this chapter
Try a question
Answer it here to see how it works. Nothing is recorded until you sign in.
Question 1
Level 1: Warm-up
Statement 1: The theoretical maximum speedup of a k-stage pipeline is bounded by k, assuming ideal conditions with no stalls.
Statement 2: When calculating the actual speedup of a pipelined processor, the increase in clock cycle time due to latch overhead can be ignored if the number of pipeline stages is sufficiently large.
Which of the following is correct?
Question 2
Level 1: Warm-up
Which of the following statements regarding data forwarding (bypassing) in a standard 5-stage pipelined processor is strictly TRUE?
Question 3
Level 1: Warm-up
Assertion (A): In a standard 5-stage pipeline with full forwarding hardware, the instruction sequence ADD R1, R2, R3 followed immediately by SUB R4, R1, R5 requires zero stall cycles.
Reason (R): The result of the ADD instruction is available at the end of its Execute (EX) stage and can be forwarded directly from the EX/MEM pipeline register to the ALU input of the SUB instruction at the beginning of its EX stage.
Question 4
Level 1: Warm-up
A 4-stage pipeline has individual stage delays of 10 ns, 15 ns, 12 ns, and 14 ns. The inter-stage pipeline registers (latches) have a delay of 2 ns each. What is the minimum clock cycle time (in ns) required for this pipeline to operate correctly without data corruption?
Question 5
Level 1: Warm-up
A 4-stage pipeline has stage delays of 100, 120, 110, and 130 nanoseconds. The inter-stage registers have a delay of 10 nanoseconds. The total time to execute 50 independent instructions on this pipeline, assuming no stalls, is __________ nanoseconds.
Question 6
Level 1: Warm-up
For a k-stage pipeline, the speedup S is bounded by a maximum theoretical value as the number of instructions n approaches infinity. If a pipeline has 8 stages, what is this maximum boundary value for the speedup?
Question 7
Level 1: Warm-up
Statement 1: The clock cycle time of a pipeline is bounded below by the delay of the slowest pipeline stage.
Statement 2: The inter-stage latch delay can be ignored if the stage delays are significantly larger.
Which of the following is correct?
Question 8
Level 1: Warm-up
A program executes 500 instructions on a pipeline where the ideal CPI is 1. Due to data hazards, the actual CPI is measured to be 1.2. How many total stall cycles are introduced during this execution compared to the ideal case?
Question 9
Level 1: Warm-up
An instruction mix consists of 50% ALU (0 stalls), 30% Load (2 stalls), and 20% Branch (1 stall). A student incorrectly calculates the average stall cycles per instruction by simply summing the stall penalties of all instruction types (0 + 2 + 1). What is the absolute difference between the student's incorrect calculation and the correct average stall cycles per instruction?
Question 10
Level 1: Warm-up
Assertion (A): The total execution time of a program on a pipelined processor is calculated as the product of the instruction count, the actual CPI, and the clock cycle time.
Reason (R): The actual CPI is a dimensionless quantity representing the average number of clock cycles per instruction, and multiplying it by the instruction count directly yields the total execution time in seconds.
Free preview ends here
Login to view the complete short notes
Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.
Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.
Built around you, not around a syllabus PDF
Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.
Revision that hits your weak spots
We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.
Questions calibrated to the real exam
Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.
Notes written for recall, not for volume
Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.
One place for everything
Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.
Honest progress
No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.
Unlock the whole course
Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.
Processor Performance, Pipelining and Hazards Short Notes for GATE CS
Processor Performance, Pipelining and Hazards short notes for GATE CS: 5 study cards covering concepts, formulas, shortcuts and exam traps, plus solved practice questions.
Quick Reference: Pipeline Timing Formulas
Quick Reference: Pipeline Timing
Metric
Formula
Notes
Cycle Time
Tcycle=max(ti)+tlatch
Determined by the slowest stage.
Total Cycles
Cycles=k+n−1
k stages, n instructions.
Total Time
Ttotal=(k+n−1)×Tcycle
Assumes no stalls or hazards.
Throughput
TP=Ttotaln
Instructions completed per unit time.
Speedup
S=TtotalTnon−pipe
Max ideal speedup is k.
Quick Reference: CPI and Speedup Formulas
Quick Reference: CPI and Speedup
Metric
Formula
Notes
Actual CPI
CPIactual=CPIideal+Avg Stalls
CPIideal is typically 1.
Avg Stalls
∑(Freqi×Penaltyi)
Weighted sum of all hazard penalties.
Clock Rate
f=Tcycle1
Ensure units match (e.g., GHz and ns).
Execution Time
Texec=Inst. Count×CPI×Tcycle
The fundamental performance equation.
Speedup
S=TpipeTnon−pipe
Always use actual times, not just stage counts.
Quick Reference: Dependencies and Forwarding
Quick Reference: Dependencies and Forwarding
Dependency
Type
Hazard in 5-Stage?
Resolution
RAW
True Data
Yes
Forwarding (0 stalls) or Stall (1 cycle for LOAD)
WAR
Name (Anti)
No
Naturally avoided by in-order execution
WAW
Name (Output)
No
Naturally avoided by in-order execution
Golden Rule: If the producer is an ALU instruction, forwarding yields 0 stalls. If the producer is a LOAD instruction, forwarding yields 1 stall.
Branch Prediction Quick Reference
Branch Prediction Quick Reference
Concept
Key Takeaway
Control Hazard
Caused by branch instructions changing the PC.
Stall/Flush
Baseline solution. Penalty = (Resolve Stage - 1).
Static Predict Not Taken
Best default. 0 penalty if not taken, flush if taken.
1-Bit Predictor
Flips on every misprediction. Bad for loops (2 errors/loop).
2-Bit Predictor
Requires 2 consecutive mispredictions to flip. Good for loops (1 error/loop).
Effective CPI
CPIbase+(Branch %)×(Mispredict %)×(Penalty)
Processor Performance, Pipelining and Hazards: Solved Questions with Step-by-Step Explanations (10 Problems)
Question 1 · Computer Organization and ArchitectureMCQ
Statement 1: The theoretical maximum speedup of a k-stage pipeline is bounded by k, assuming ideal conditions with no stalls.
Statement 2: When calculating the actual speedup of a pipelined processor, the increase in clock cycle time due to latch overhead can be ignored if the number of pipeline stages is sufficiently large.
Which of the following is correct?
A.
Statement 1 only
B.
Statement 2 only
C.
Both statements
D.
Neither statement
Correct Answer:
A
Step-by-Step Solution
Key idea: This is a bounding question evaluating the fundamental constraints of pipeline speedup calculations.
Step 1: Evaluate Statement 1. In an ideal pipeline with no stalls and no clock rate change, the speedup is exactly k. This is the theoretical upper bound. Statement 1 is true.
Step 2: Evaluate Statement 2. Latch overhead increases the clock cycle time, which directly reduces the clock rate and thus the actual speedup. This overhead is a physical constraint and can never be ignored in exact speedup calculations, regardless of the number of stages. Statement 2 is false.
Step 3: Conclude that only Statement 1 is true.
Answer: A
Question 2 · Computer Organization and ArchitectureMCQ
Which of the following statements regarding data forwarding (bypassing) in a standard 5-stage pipelined processor is strictly TRUE?
A.
Forwarding from the MEM/WB register to the EX stage completely eliminates the stall cycle for a LOAD instruction immediately followed by a dependent ALU instruction.
B.
EX to EX forwarding routes the result from the ALU output of the producer directly to the ALU input of the consumer, requiring 0 stall cycles for back-to-back ALU instructions.
C.
Data forwarding allows a consumer instruction to read the correct value directly from the register file before the producer has reached the Write Back stage.
D.
Forwarding hardware is primarily designed to resolve Write-After-Read (WAR) hazards that naturally occur in standard in-order pipelines.
Correct Answer:
B
Step-by-Step Solution
Key idea: This is a bounding question testing the exact capabilities and limitations of forwarding hardware.
Step 1: Evaluate Option A. A LOAD instruction only has its data ready at the end of the MEM stage. Even with MEM to EX forwarding, an immediately dependent ALU instruction needs the data at the beginning of its EX stage. This timing mismatch still requires exactly 1 stall cycle. (False).
Step 2: Evaluate Option B. For back-to-back ALU instructions, the producer generates the result at the end of its EX stage. EX to EX forwarding routes this directly to the consumer's ALU input for its EX stage. This requires 0 stall cycles. (True).
Step 3: Evaluate Option C. Forwarding bypasses the register file entirely; it does not read from the register file early. (False).
Step 4: Evaluate Option D. WAR hazards do not occur in standard in-order pipelines, and forwarding is designed for RAW hazards. (False).
Answer: Option B.
Question 3 · Computer Organization and ArchitectureMCQ
Assertion (A): In a standard 5-stage pipeline with full forwarding hardware, the instruction sequence ADD R1, R2, R3 followed immediately by SUB R4, R1, R5 requires zero stall cycles.
Reason (R): The result of the ADD instruction is available at the end of its Execute (EX) stage and can be forwarded directly from the EX/MEM pipeline register to the ALU input of the SUB instruction at the beginning of its EX stage.
A.
Both A and R are true, and R is the correct explanation of A.
B.
Both A and R are true, but R is NOT the correct explanation of A.
C.
A is true, but R is false.
D.
A is false, but R is true.
Correct Answer:
A
Step-by-Step Solution
Key idea: This is a construction question testing the precise hardware mechanism that resolves arithmetic hazards.
Step 1: Evaluate Assertion (A). An ALU instruction followed by a dependent ALU instruction is a classic arithmetic hazard. With full forwarding, this requires 0 stall cycles. Assertion A is true.
Step 2: Evaluate Reason (R). The ADD instruction produces its result at the end of the EX stage. This result is latched in the EX/MEM pipeline register. The SUB instruction needs this value at the beginning of its EX stage. The forwarding path routes the data directly from the EX/MEM register to the ALU input. Reason R is true and perfectly explains A.
Step 3: Conclude the relationship. Both are true, and R is the correct explanation.
Answer: Option A.
Question 4 · Computer Organization and ArchitectureMCQ
A 4-stage pipeline has individual stage delays of 10 ns, 15 ns, 12 ns, and 14 ns. The inter-stage pipeline registers (latches) have a delay of 2 ns each. What is the minimum clock cycle time (in ns) required for this pipeline to operate correctly without data corruption?
A.
15
B.
17
C.
53
D.
55
Correct Answer:
B
Step-by-Step Solution
Key idea: This is a direct application of the pipeline cycle time formula, identifying the bottleneck stage.
Step 1: Recall the formula for the clock cycle time: Tcycle=max(t1,t2,…,tk)+tlatch.
Step 2: Identify the maximum stage delay from the given values: max(10,15,12,14)=15 ns.
Step 3: Add the latch delay: Tcycle=15+2=17 ns.
Answer: B
Question 5 · Computer Organization and ArchitectureNAT
A 4-stage pipeline has stage delays of 100, 120, 110, and 130 nanoseconds. The inter-stage registers have a delay of 10 nanoseconds. The total time to execute 50 independent instructions on this pipeline, assuming no stalls, is __________ nanoseconds.
Correct Answer:
7420.00
Step-by-Step Solution
Key idea: This is a direct formula application for total pipeline execution time.
Step 1: Identify the maximum stage delay, which is max(100,120,110,130)=130 ns.
Step 2: Calculate the clock cycle time: Tcycle=max(ti)+tlatch=130+10=140 ns.
Step 3: Calculate the total number of cycles for n=50 instructions in a k=4 stage pipeline: Cycles=k+n−1=4+50−1=53 cycles.
Step 4: Compute the total execution time: Ttotal=53×140=7420 ns.
Answer: 7420.00
Question 6 · Computer Organization and ArchitectureMCQ
For a k-stage pipeline, the speedup S is bounded by a maximum theoretical value as the number of instructions n approaches infinity. If a pipeline has 8 stages, what is this maximum boundary value for the speedup?
A.
8
B.
7
C.
9
D.
Infinity
Correct Answer:
A
Step-by-Step Solution
Key idea: This is an observation question about the asymptotic boundary of pipeline speedup.
Step 1: Recall the speedup formula: S=TtotalTnon−pipe=k+n−1n×k.
Step 2: Observe the limit as n→∞. The −1 and +k become negligible compared to n.
Step 3: The limit simplifies to nn×k=k.
Step 4: For an 8-stage pipeline, k=8. The maximum boundary value is 8.
Answer: A
Question 7 · Computer Organization and ArchitectureMCQ
Statement 1: The clock cycle time of a pipeline is bounded below by the delay of the slowest pipeline stage.
Statement 2: The inter-stage latch delay can be ignored if the stage delays are significantly larger.
Which of the following is correct?
A.
Statement 1 only
B.
Statement 2 only
C.
Both statements
D.
Neither statement
Correct Answer:
A
Step-by-Step Solution
Key idea: This is a bounding question evaluating the fundamental constraints of pipeline cycle time calculation.
Step 1: Evaluate Statement 1. The clock cycle time is Tcycle=max(ti)+tlatch. Since tlatch≥0, Tcycle≥max(ti). Thus, it is bounded below by the slowest stage delay. Statement 1 is true.
Step 2: Evaluate Statement 2. The latch delay represents the setup and propagation time of the pipeline registers. It must always be added to the maximum stage delay. Ignoring it violates the timing constraint and leads to data corruption, regardless of how large the stage delays are. Statement 2 is false.
Step 3: Conclude that only Statement 1 is true.
Answer: A
Question 8 · Computer Organization and ArchitectureMCQ
A program executes 500 instructions on a pipeline where the ideal CPI is 1. Due to data hazards, the actual CPI is measured to be 1.2. How many total stall cycles are introduced during this execution compared to the ideal case?
A.
100
B.
400
C.
500
D.
600
Correct Answer:
A
Step-by-Step Solution
Key idea: This is a casework question calculating the absolute number of stall cycles from the CPI difference.
Step 1: Identify the given values: Instruction count (n) = 500, Ideal CPI = 1, Actual CPI = 1.2.
Step 2: Calculate the ideal total cycles: 500×1=500 cycles.
Step 3: Calculate the actual total cycles: 500×1.2=600 cycles.
Step 4: Find the difference (total stall cycles): 600−500=100 cycles.
Answer: A
Question 9 · Computer Organization and ArchitectureMCQ
An instruction mix consists of 50% ALU (0 stalls), 30% Load (2 stalls), and 20% Branch (1 stall). A student incorrectly calculates the average stall cycles per instruction by simply summing the stall penalties of all instruction types (0 + 2 + 1). What is the absolute difference between the student's incorrect calculation and the correct average stall cycles per instruction?
A.
0.8
B.
1.2
C.
2.2
D.
3.0
Correct Answer:
C
Step-by-Step Solution
Key idea: This is a contradiction question highlighting the error of unweighted summation versus the correct weighted average for stall cycles.
Step 1: Calculate the correct average stall cycles: (0.5×0)+(0.3×2)+(0.2×1)=0+0.6+0.2=0.8.
Step 2: Identify the student's incorrect calculation: 0+2+1=3.0.
Step 3: Find the absolute difference: ∣3.0−0.8∣=2.2.
Answer: C
Question 10 · Computer Organization and ArchitectureMCQ
Assertion (A): The total execution time of a program on a pipelined processor is calculated as the product of the instruction count, the actual CPI, and the clock cycle time.
Reason (R): The actual CPI is a dimensionless quantity representing the average number of clock cycles per instruction, and multiplying it by the instruction count directly yields the total execution time in seconds.
A.
Both A and R are true and R is the correct explanation of A.
B.
Both A and R are true but R is NOT the correct explanation of A.
C.
A is true but R is false.
D.
A is false but R is true.
Correct Answer:
C
Step-by-Step Solution
Key idea: This is a construction and unit analysis question evaluating the assertion-reason pair for pipeline execution time.
Step 1: Evaluate Assertion (A). The formula Texec=Instruction Count×Actual CPI×Tcycle correctly constructs the total execution time. This is true.
Step 2: Evaluate Reason (R). The actual CPI is indeed dimensionless (cycles/instruction). Multiplying it by the instruction count yields the total number of clock cycles (dimension: cycles). However, to get time in seconds, you must multiply by the clock cycle time (seconds/cycle). Reason (R) claims this product directly yields seconds, which is a unit mismatch. Thus, Reason (R) is false.