Question Details

Which one of the following dependencies among the register operands of different instructions can cause a data hazard in a pipelined processor?

Options

A

Read-after-read

B

Read-after-write

C

Write-after-read

D

Write-after-write

Show Answer
Correct Answer
B Read-after-write

Solution :

The correct option is Read-after-write.

In a pipelined processor, data hazards occur when instructions that are close together in the instruction stream depend on the same register operands, and the execution overlap causes the operands to be accessed in an incorrect order.
Let us analyze the different types of register dependencies to understand why a Read-after-write (RAW) dependency causes a data hazard in standard pipelined processors:

1. Read-After-Write (RAW) Dependency:
This is also known as a true data dependency. It occurs when an instruction (say, Instruction B) reads a register that is written by a preceding instruction (say, Instruction A).
If Instruction B tries to read the register value before Instruction A has finished writing the updated value to it, Instruction B will read stale (incorrect) data. This represents a data hazard because the pipeline must be stalled, or data forwarding must be used, to ensure Instruction B receives the correct, updated value.

2. Read-After-Read (RAR) Dependency:
This occurs when two instructions both read from the same register. Since neither instruction modifies the value of the register, the order of reading does not affect the correctness of the program. Therefore, RAR dependencies never cause a data hazard.

3. Write-After-Read (WAR) Dependency:
This is also known as an anti-dependency. It occurs when an instruction (Instruction B) writes to a register that is read by an earlier instruction (Instruction A).
In a standard, in-order execution pipeline, Instruction A will always read the register value before Instruction B reaches its writeback stage to modify it. Thus, it does not cause a data hazard in simple pipelines.

4. Write-After-Write (WAW) Dependency:
This is also known as an output dependency. It occurs when an instruction (Instruction B) writes to the same register that is written by a preceding instruction (Instruction A).
In standard in-order pipelines, writes to the register file occur in program order during the Write-Back stage, meaning Instruction B will write its result after Instruction A, leaving the correct final value in the register. Hence, WAW dependencies do not cause hazards in simple pipelines.

Consequently, among the given dependencies, only Read-after-write represents a true data dependency that can cause a data hazard in a pipelined processor.

Transparent Access on Mindyard

Built for Learners & Educators Alike

Completely free for students. Educators & coaching institutes get 2 months free Pro trial to create tests.

FREE FOR STUDENTS

Practice & Learn Free for Students

Access unlimited practice questions, detailed step-by-step solutions, and exam study materials — completely free for students.

  • Unlimited mock tests & question bank practice
  • Full access to curated study library & formula notes
  • 100% free for students • No credit card required
2 MONTHS FREE TRIAL

Educators & Coaching Institutes

Create and conduct professional online assessments with AI question generation, tab proctoring, and comprehensive batch management.

  • AI question uploader & rapid test generator
  • Anti-cheating tab proctoring & performance reports
  • Full Pro access free for 60 days • No upfront commitment
Discover more resources

You may also like

Mock Tests

View All
  • CUET UG
  • intermediate
  • 1 hour

A comprehensive CUET UG Mathematics Question Paper with Solutions – 2 June 2023 (Shift 3) designed to help students practice and understand the actual CUET exam pattern. This paper covers important topics from Algebra, Calculus, Coordinate Geometry, Probability, Statistics, Matrices, Determinants, and Vectors, featuring a balanced mix of conceptual, numerical, and application-based questions. Detailed solutions are provided to strengthen problem-solving skills, improve conceptual clarity, and enhance calculation accuracy. Based on the CUET syllabus and previous year exam trends, this paper is ideal for practice, revision, self-assessment, time management, previous year analysis, and final preparation for upcoming CUET UG Mathematics examinations.

  • CUET UG
  • intermediate
  • 1 hour

A comprehensive CUET Accountancy Question Paper – 20 June 2023 (Shift 2) designed to help students practice and analyze previous year exam patterns for effective CUET preparation. This paper covers important topics including Accounting for Partnership Firms, Company Accounts, Financial Statements Analysis, Cash Flow Statements, Accounting Ratios, and Fundamental Accounting Principles. It features a balanced mix of conceptual, numerical, and application-based questions to strengthen accounting concepts, improve calculation accuracy, and enhance problem-solving skills. Based on the CUET exam structure and syllabus, this paper is ideal for practice, revision, self-assessment, time management, previous year analysis, and final preparation for upcoming CUET Accountancy examinations.

Ask AI Tutor
5 left
Q1 View Question & Options
AI Tutor is solving this question...
Reading question context & options...
Ask your own doubt or choose a quick prompt: