1. Data Hazards
An overview of data hazards in computer
architecture and their impact on execution.
Aashiq
Ilahi
230071601246
230071601234
23007160197
Syed Ashiq
Ameer
Thananjai
2. • In computer architecture, data hazards occur when there are dependencies
between instructions that can lead to errors or delays in execution.
Data Hazards
3. • Read After Write (RAW) hazard, also known as true dependency, occurs when an instruction
depends on the result of a previous instruction. This situation arises in a pipeline when the
data being read has not yet been written back by the preceding instructions. Proper handling
of RAW hazards is essential to maintain data integrity and correct program execution.
Read After Write (RAW)
Types of Data Hazards
5. • Write After Read (WAR) hazard, also known as anti-dependency, arises when an instruction writes
to a location before a previous instruction has read from that location. This can lead to incorrect
program behavior, as the reading instruction may not access the original data. Techniques such
as instruction reordering can help mitigate this hazard in pipelined processing.
Write After Read
(WAR)
Types of Data Hazards
6. • Write After Write (WAW) hazard occurs when two instructions attempt to write to the same
location, with the order of writes affecting the final outcome. This type of hazard can cause
incorrect results if the writing instructions are executed out of order. Managing WAW hazards is
vital for maintaining data consistency in pipelined architectures, often requiring techniques such
as careful scheduling and resource management.
Write After Write
(WAW)
Types of Data Hazards
7. • Data forwarding, also known as data bypassing, is a technique used to reduce the impact of
data hazards by directly connecting outputs of one instruction to the inputs of another without
writing to memory. This allows subsequent instructions to utilize the most recent data quickly,
thereby reducing latency and enhancing overall execution speed in a pipelined environment.
Data Forwarding
Handling Data Hazards
9. • Pipeline stalls are a straightforward method to handle data hazards, where the pipeline is
temporarily halted to allow time for prior instructions to complete their execution. Although
this approach can effectively prevent hazards, it may lead to performance degradation due to
increased cycle times and resource underutilization in scenarios with frequent stalls.
Pipeline stalls
Handling Data Hazards
11. Questions
1. What are Data Hazards? Mention it’s types.
2. Compare ‘Write after Read (WAR)’ data hazard and
‘Write after Write after Write (WAW)’ data hazard
3. What are some methods to handle Data Hazards?