Pipelining is a technique of breaking a sequential process into small fragments or sub-operations. The execution of each of these sub-procedure takes place in a certain dedicated segment that functions together with all other segments. There are three types of Pipelining conflicts that are as follows −
These conflicts arise due to insufficient resources wherein it is not possible to overlap the operations. The performance of pipelined processor depends on either of the two conditions are as follows −
If for a particular combination, the pipeline is stalled to avoid resource conflicts, then there is a structural hazard.
Structural hazard occurs if two instructions need the help of a given hardware resource at an equal time. The most common situation in which this hazard occurs is when resources request for memory.
Consider a situation where one instruction needs to access memory for storage of the result while another instruction is being fetched. If the instructions and data reside in the same cache unit, only one instruction can proceed and the other instruction is delayed. To avoid this conflict many processors use separate caches for instruction and data.
These conflicts arise when the instruction in the pipeline depends on the result of the previous instructions and these instructions are still in pipeline and are not executed yet.
When either the source or the destination operand of an instruction is not available at the expected time in the pipeline, the pipeline is stalled. Such a situation is termed as a data hazard of data conflict.
Consider a program with two instructions, I1 followed by I2. When this program is executed in a pipeline, the execution of these two instructions is performed concurrently. If the result of I1 and I2 are dependent on each other, then the result of I1 may not be available for the execution of I2.
This difficulty is faced when the branch and other instructions change the contents of the program counter. There are two kinds of branches such as conditional and unconditional. Conditional branches may or may not cause branching but an unconditional branch always causes branching. This difficulty is termed a control hazard.
The following critical actions can be followed during the pipelining process which helps in handling control hazard −