Page 114 - Computer_Science_F5
P. 114
the scalar approach? Briefly else, goto negative, the processor must
explain your reasoning. decide which branch to fetch instructions
for. Incorrect predictions waste cycles.
2. Which of the following statements
accurately describes the key
difference between a scalar and a There are two primary techniques: Chapter Two: Performance and optimisation of computer processor
FOR ONLINE READING ONLY
superscalar processor? (a) Static prediction: The processor
consistently predicts a branch as
(a) Scalar processors can exploit taken or not taken, which is simple
out-of-order execution, while but often inaccurate.
superscalar processors cannot. (b) Dynamic prediction: This method
(b) Superscalar processors have uses the branch’s history to predict
multiple execution units, future behavior, resulting in higher
whereas scalar processors have accuracy. Common implementations
only one. include Branch Prediction Buffers
(c) Scalar processors are more (BPBs) and Branch History Tables
complex due to dynamic (BHTs).
scheduling, unlike superscalar
processors. Branch Prediction Buffers (BPBs) with
(d) Superscalar processors require 1-bit scheme
compiler intervention for
parallel execution, while scalar A Branch Prediction Buffer (BPB) is
processors do not. a small memory indexed by the lower
bits of a branch instruction’s address,
Branch prediction storing a single bit to indicate predicted
Branch prediction addresses the challenge behavior: 0 for not taken and 1 for
of conditional branches, which alter taken. For example, a loop branch taken
program flow based on conditions. By nine times in a row but not taken once
predicting which path a branch will take, would have an 80% prediction accuracy,
processors enhance performance. For despite being taken 90% of the time, as
instance, given if (x > 0), goto positive; shown in Table 2.6.
Table 2.6: Branch outcomes with a 1-bit prediction scheme
Iteration BPB prediction Actual branch Outcome update
1 1 (Taken) Taken Correct prediction (No update)
2 1 (Taken) Taken Correct prediction (No update)
3 1 (Taken) Taken Correct prediction (No update)
4 1 (Taken) Taken Correct prediction (No update)
5 1 (Taken) Taken Correct prediction (No update)
105
Student’s Book Form Five
Computer Science Form 5.indd 105 23/07/2024 12:33