Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Puzzle Bank
  • SystemVerilog Language Puzzles25
    • Datatype and Bit Puzzles
    • Fork Join Puzzles
      • join vs join_any vs join_none
      • Loop Variable Capture in Detached Threads
      • wait fork Synchronization Point
      • disable Named Fork Scope
      • join_any Without Cleanup
      • Inner disable fork Does Not Kill Outer Sibling
    • Queue and Array Puzzles
    • String and Casting Puzzles
    • SystemVerilog Language Puzzles: Tricky Q&A
  • Difficulty Guide
  • Full Topic Map
  • Interview-Day Tips
  • OOP & Testbench Puzzles25
  • Concurrency & Timing Puzzles25
  • Randomization & Constraint Puzzles25
  • SVA Assertion Puzzles25
  • Functional Coverage Puzzles25
  • Logic & Aptitude Puzzles25
  • Scenario & Debug Puzzles25
  • Interview Prep: Puzzle Rounds5
  • DV Puzzle Cheatsheet
Loading lesson

‹Fork Join Puzzles
  1. Topics
  2. DV Interview Puzzles
  3. SystemVerilog Language Puzzles
  4. Fork Join Puzzles
  5. Inner disable fork Does Not Kill Outer Sibling

VLSI DV Interview Puzzles · All levels

Inner disable fork Does Not Kill Outer Sibling

Which prints survive this nested-fork pattern, and why?

On this page

    Puzzle

    Difficulty: Hard · Puzzle 6 of 6 · Topic: Fork Join Puzzles

    Which prints survive this nested-fork pattern, and why?

    Code

    p6.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    module p6;
      initial begin
        fork
          begin
            fork
              begin #2 $display("%0t A", $time); end
              begin #4 $display("%0t B", $time); end
            join_any
            disable fork;
            $display("%0t C", $time);
          end
          begin
            #3 $display("%0t D", $time);
          end
        join
        $display("%0t E", $time);
      end
    endmodule

    Hint

    `disable fork` applies to child processes of the process that calls it (its innermost active fork context).

    Step-by-step solution

    Diagram
    1) In inner fork, A prints at t=2; `join_any` unblocks immediately.
    2) `disable fork` then kills inner sibling B before t=4.
    3) C prints at t=2 after cleanup.
    4) Outer sibling D is in a different fork context, so it still prints at t=3.
    5) Outer join completes at t=3 and E prints at t=3.

    Answer

    Answer: A@2, C@2, D@3, E@3; B does not print

    Why candidates get it wrong

    A common bug is assuming `disable fork` is global and kills unrelated sibling branches.

    Interviewer follow-up

    How would you explicitly terminate both outer branches from inside the first branch?

    Related topics

    • Back to Fork Join Puzzles

    • SystemVerilog Language Puzzles section

    Previous

    16 / 210

    Next: Queue and Array Puzzles

    Up next

    Up nextQueue and Array Puzzles

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • join vs join_any vs join_none
    • Loop Variable Capture in Detached Threads
    • wait fork Synchronization Point