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

AboutRoadmapCareersInternshipsFAQContactPrivacyTerms
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
  • Study Route: One Week Before the Interview
  • Study Route: Two Weeks
  • Study Route: Four Weeks (Full Course)4
  • OOP & Testbench Puzzles25
  • Concurrency & Timing Puzzles25
  • Randomization & Constraint Puzzles25
  • SVA Assertion Puzzles25
  • Functional Coverage Puzzles25
  • Logic & Aptitude Puzzles25
  • Scenario & Debug Puzzles25
  • UVM Testbench Puzzles25
  • Clock, Reset & CDC Puzzles25
  • Bus and Interface Protocol Puzzles25
  • Interview Prep: Puzzle Rounds7
  • DV Puzzle Cheatsheet
Loading lesson

←Fork Join Puzzles
  1. Topics
  2. DV Interview Puzzles
  3. SystemVerilog Language Puzzles
  4. Fork Join Puzzles
  5. wait fork Synchronization Point
On this page

    VLSI DV Interview PuzzlesAll levels

    wait fork Synchronization Point

    Order these prints by time and explain what `wait fork` waits for.

    Puzzle

    Difficulty: Easy · Puzzle 3 of 6 · Topic: Fork Join Puzzles

    Order these prints by time and explain what `wait fork` waits for.

    Code

    p3.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    `timescale 1ns/1ns
    module p3;
      initial begin
        fork
          #3 $display("%0t A", $time);
          #7 $display("%0t B", $time);
        join_none
        $display("%0t parent_after_join_none", $time);
        wait fork;
        $display("%0t parent_after_wait_fork", $time);
      end
    endmodule

    Hint

    `join_none` returns immediately, but `wait fork` blocks until all currently active children from this process finish.

    Step-by-step solution

    Diagram
    1) Parent prints `parent_after_join_none` at t=0 immediately after spawning children.
    2) Child A prints at t=3.
    3) Child B prints at t=7.
    4) `wait fork` unblocks only after both children complete, so final parent print is at t=7.

    Answer

    Answer: parent_after_join_none@0, A@3, B@7, parent_after_wait_fork@7

    How this was checked

    Checked by running the code in Icarus Verilog 13 and Verilator 5; the printed output supports the answer above. wait fork returns only after the last child finishes. (Icarus, 4-state) wait fork returns only after the last child finishes. (Verilator, 2-state)

    Why candidates get it wrong

    `wait fork` waits for ALL child processes of the calling process, not just the last one spawned, so a single child that never finishes blocks the parent forever.

    Interviewer follow-up

    What if one of the forked children is a `forever` loop? Model answer: `wait fork` never returns, the parent hangs for the rest of the simulation (run: the line after wait fork never printed, only a watchdog fired); disable that child first or use `fork ... join_any` plus `disable fork` with a timeout instead.

    Say it out loud

    I would note that wait fork blocks until all children of the calling process are done, not just the last one. So the parent prints at time 0 right after the join none, child A prints at 3, child B at 7, and the parent prints again at 7. The trap is that one child that never finishes, like a forever loop, would hang the parent for good. I would check every child has an end, or add a timeout with join any and disable fork.

    Related topics

    • Threads and Control: Fork, Disable, Wait, Process

    • Back to Fork Join Puzzles

    • SystemVerilog Language Puzzles section

    Previous

    19 / 293

    Next: disable Named Fork Scope

    Up next

    Up nextdisable Named Fork Scope

    Sign in to save progress

    Practice this lessonPrevious lessonReport an error

    See also

    • join vs join_any vs join_none
    • join_any Without Cleanup
    • Inner disable fork Does Not Kill Outer Sibling