Explore fundamental concepts of control, data, and structural hazards in pipelined processors with this quiz. Enhance your comprehension of hazard types, pipeline behavior, and common solutions in computer architecture.
Which type of hazard occurs when the pipeline makes incorrect predictions regarding the next instruction to execute, such as after a branch instruction?
Explanation: A control hazard arises when the flow of instructions is altered, typically by branches and jumps, leading to uncertainty in the pipeline. Data hazards involve dependencies between data in instructions. Structural hazards are due to hardware resource conflicts. Resource hazard is a less precise term and generally refers to structural hazards.
If two instructions in the pipeline need access to the same memory unit at the same time, what type of hazard does this situation create?
Explanation: A structural hazard occurs when hardware resources are inadequate for simultaneous operations. Control hazards are related to instruction flow changes. Timing hazard is not a commonly used term in this context. Data hazards refer to conflicts with data dependencies, not resource usage.
What kind of hazard happens when an instruction depends on the result of a previous instruction that has not yet completed, such as reading a register before it’s updated?
Explanation: Data hazards involve dependencies where one instruction requires data that is yet to be produced by another. Control hazards are about instruction sequence changes. Instruction hazard is not a specific standard type. Structural hazards are due to hardware resource conflicts, not data dependencies.
Which technique reduces data hazards by forwarding data from later pipeline stages to earlier ones, as seen in operations like add followed by another add?
Explanation: Data forwarding (bypassing) provides results directly to the dependent instruction, minimizing pipeline delays. Stalling pauses the pipeline but is less efficient. Branch prediction addresses control hazards, not data dependencies. Resource duplication targets structural hazards.
When the pipeline temporarily stops processing new instructions to resolve a data dependency, what is this method called?
Explanation: Stalling introduces delays by halting instruction processing until dependencies are resolved. Pipelining is the method of instruction overlap, not specifically a hazard solution. Branching refers to conditional jumps in program flow. Decoding is the instruction interpretation step, not a hazard resolution technique.
Which hazard can be mitigated using techniques like 'branch prediction' to improve pipeline efficiency?
Explanation: Branch prediction aims to guess the outcome of branch instructions, reducing idle pipeline cycles due to control hazards. Data hazards are resolved using forwarding or stalls. 'Structure hazard' is a typo for structural hazard, but branch prediction does not address structural hazards. 'Path hazard' is not a standard term in this context.
If a pipelined processor has only one unified memory for instructions and data, what hazard might this cause when fetching and loading simultaneously?
Explanation: A single memory unit becomes a resource bottleneck, causing a structural hazard when simultaneous instruction and data access are required. Data hazards relate to information dependencies. Logic hazard is not a recognized standard in this context. Control hazards pertain to branch instructions, not resources.
When one instruction needs a value produced by a previous instruction, as in 'ADD R1, R2, R3' followed by 'SUB R4, R1, R5', what is the hazard type involved?
Explanation: The dependency occurs because the second instruction relies on the register updated by the first, which defines a data hazard. 'Order hazard' and 'redundant hazard' are not standard types. 'Structure hazard' concerns resource contention, not data dependencies.
Which condition prevents structural hazards in a pipeline architecture?
Explanation: Ensuring adequate resources prevents resource conflicts, thus avoiding structural hazards. Stalling is a response to certain hazards, not a way to prevent structural hazards. Random branch prediction is related to control hazards. Overlapping fetch with execution is standard in pipelining and does not specifically prevent hazards.
What is the main function of inserting a 'bubble' (NOP) in a pipeline when a hazard is detected?
Explanation: A bubble or NOP halts pipeline advancement, ensuring hazards don't lead to incorrect results. It does not speed up execution, but introduces a delay. Bubbles do not replace branch prediction as they mainly address data and control hazards. They don't solve simultaneous resource access issues, which require hardware solutions.