About Me

My photo
santrampur, gujarat, India
i am a hunger of knowledge

Wednesday, December 29, 2010

the different types of hazards

There are three types of hazards.

                              [1]  Structural hazards
                              [2]  Data hazards
                              [3]  Control hazards

                  [1] STRUCTURAL HAZARDS

                                    When a machine is pipelined the overlapped execution of instructions requires pipelining of functional units and duplication of resources to allow all possible combinations of instructions in the pipeline. If some combinations of instructions cannot be accommodated because of resource conflicts, the machine is said to have a structural hazard. The most common instances of structural hazards a lies when some functional units is not fully pipelined Then a sequence of instructions using that not pipelined unit cannot proceed at the rate of one per clock cycle. Another common way that structural hazards appear is when some resource has not been duplicated enough to allow all combinations of instructions in the pipeline to execute.  
                        For Example
                                    A machine may have only one register. File write part but under certain circumstances the pipeline might want to perform two writes in a clock cycle.
                                   

                  [2] DATA HAZARDS
                                   
                                    A major effect of pipelining is to change the relative timing of instructions by overlapping their execution. This introduces data and control hazards. Data hazards occur when the pipeline changes the order or read/ write accesses to operands. So, that the order differs from the order seen by sequentially executing instructions on not pipelined machine.
                 
                  [3] CONTROL HAZARDS
                                               
                                    Control hazards can cause a greater performance loss than the data hazards when a branch is executed. It may or may not change the PC to something other than its current value recall that if a branch changes the PC to its forget address, it is a taken branch, if it falls through. It is not taken branch then the PC is normally not until the end of MEM, after the completion of the address calculation and comparison.

                                    The simplest method of dealing with branches is to stall the pipeline as soon as we detect the branch until we reach the MEM stage, which determines the new PC of course. We do not want to saw the pipeline until we know that the instruction is a branch.

No comments:

Post a Comment