In Computer Science, Data Hazard occurs when

By Mandeep Kumar|Updated : July 21st, 2022

Data Hazard occurs due to data dependency. The location must appear executing in the sequential order whenever two different instructions use the same storage. Data hazard producing incorrect results can be eliminated.

Answer: Data Hazard occurs when the execution of an instruction depends on the result of the previous instruction and that result of instruction has not been computed yet.

Data dependencies can be categorized into four types Read after Read (RAR), Write after Write (WAW), Read after Write (RAW), and Write after Read (WAR).

Four types of Data dependency in Data Hazard

The four types of data dependencies have been elucidated below:

  • Read after Read (RAR) hazard does not cause a problem for the processor as reading a register value does not change the register value.

  • Write after Write (WAW) hazard occurs when the output register of an instruction tries to write its result to the same register.

  • Read after Write (RAW) hazard occurs when the value produced by an instruction is required by a subsequent instruction. It is also known as true dependency or flow dependency.

  • Write after Read (WAR) hazard occurs when the output register of an instruction is used immediately after read by a previous instruction.

Summary:

In Computer Science, Data Hazard occurs when

Data hazard occurs when exhibiting data dependence changes data in different stages of a pipeline. There are three types of hazards structural hazards, data hazards, and control hazards.

Read More:

Comments

write a comment

PO, Clerk, SO, Insurance

BankingIBPS POIBPS ClerkSBI POIBPS SOSBI ClerkRBIIDBI SORRBLICESICNainital BankOtherQuick LinkMock Test

Follow us for latest updates