Quiz · Hard
Hazards, Amdahl's law, cache mapping and AMAT, virtual memory, RAID and parallelism.
Which pipeline hazard occurs when an instruction needs a result that the previous instruction has not yet produced?
Structural
Data
Control
Memory
That is a data hazard (read after write).
In the 4-stage pipeline diagram, once the pipeline is full, how many instructions complete per cycle (ideally)?

0.25
1
2
4
One instruction completes every cycle; throughput is 1 per cycle although each takes 4 cycles.
What is the purpose of forwarding in a pipeline?
Skip instructions
Send an ALU result straight to a dependent instruction without waiting for write-back
Predict branches
Flush the pipeline
It reduces stalls from data hazards.
What is the effect of a branch misprediction?
Nothing
The wrongly fetched instructions are flushed, wasting cycles
The program stops
The cache is cleared
The pipeline must discard speculative work and restart from the correct target.
According to Amdahl's law, what is the speedup if 80% of a program is made 4 times faster?
4x
3.2x
2.5x
1.25x
1 / (0.2 + 0.8/4) = 2.5.
Which is a typical RISC characteristic?
Variable-length instructions
Fixed-length instructions and load/store access
Memory operands in every instruction
Microcoded complex instructions only
RISC designs favour simple, fixed-length instructions that pipeline well.
What is spatial locality?
Reusing the same data soon
Accessing data near recently accessed data
Accessing data in random order
Using only registers
Array traversal is the standard example; cache blocks exploit it.
A cache has hit time 1 ns, miss rate 5% and miss penalty 100 ns. What is the AMAT?
5 ns
6 ns
101 ns
1.05 ns
1 + 0.05 x 100 = 6 ns.
In the cache address diagram, which field is compared with the stored value to decide a hit?
Tag
Index
Offset
Valid bit
The index selects the line, then the stored tag is compared with the address tag.
A 64 KB direct-mapped cache has 32-byte blocks. How many index bits does it use?
10
11
12
16
64 KB / 32 B = 2048 lines = 2^11, so 11 index bits (offset is 5 bits).
Which type of cache miss occurs on the very first access to a block?
Conflict
Capacity
Compulsory
Coherence
Compulsory (cold) misses cannot be avoided without prefetching.
Which write policy updates memory only when a modified line is evicted?
Write-through
Write-back
No-write-allocate
Write-around
Write-back marks the line dirty and writes it later.
Why does DRAM need refresh while SRAM does not?

DRAM stores bits as charge on leaky capacitors
SRAM is slower
DRAM has no transistors
SRAM is non-volatile
The capacitor charge decays, so rows are periodically read and rewritten.
What does a TLB cache?
Disk blocks
Recent virtual-to-physical page translations
Branch targets
Instructions
It avoids a page-table memory access on most address translations.
What is the page offset width for a 4 KiB page?
10 bits
12 bits
14 bits
16 bits
4096 = 2^12.
The diagram shows four disks with rotating parity blocks. How many disk failures can this RAID level survive?

0
1
2
4
RAID 5 tolerates one failed disk by rebuilding from the remaining data and parity.
With four 2 TB disks in RAID 5, what is the usable capacity?
2 TB
4 TB
6 TB
8 TB
One disk's worth is used for parity: 3 x 2 = 6 TB.
Which technique lets a device move data to memory without CPU involvement for each word?
Polling
DMA
Paging
Pipelining
A DMA controller transfers blocks and interrupts the CPU when done.
Which Flynn class describes a GPU executing the same instruction on many data elements?
SISD
SIMD
MISD
MIMD
SIMD (or SIMT on GPUs) applies one instruction stream to many data items.
The Moore's law chart uses a logarithmic axis. A straight line on it implies:

Linear growth
Exponential growth
No growth
Random growth
Constant doubling time gives a straight line on a log scale.
Why did CPU designers move to multicore designs around 2005?
Transistors stopped shrinking
Power and heat limited further clock-speed increases
Memory became faster than CPUs
Software no longer needed speed
The power wall made higher frequencies impractical, so more cores were added instead.