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
  • Difficulty Guide
  • Full Topic Map
  • Interview-Day Tips
  • OOP & Testbench Puzzles25
  • Concurrency & Timing Puzzles25
    • Event Scheduling Puzzles
    • Race Condition Puzzles
    • Clocking Block Puzzles
    • Semaphore & Mailbox Puzzles
      • Lock Held Across Blocking Response Wait
      • Bounded Mailbox put Deadlock
      • try_get Busy Spin at Time 0
      • Leaked Semaphore Token on Error Path
      • Two Consumers Waiting on One Mailbox
      • Deadlock-Free Request Loop with try_put/try_get
    • Concurrency & Timing Puzzles: Tricky Q&A
  • Randomization & Constraint Puzzles25
  • SVA Assertion Puzzles25
  • Functional Coverage Puzzles25
  • Logic & Aptitude Puzzles25
  • Scenario & Debug Puzzles25
  • Interview Prep: Puzzle Rounds5
  • DV Puzzle Cheatsheet
Loading lesson

‹Semaphore & Mailbox Puzzles
  1. Topics
  2. DV Interview Puzzles
  3. Concurrency & Timing Puzzles
  4. Semaphore & Mailbox Puzzles
  5. try_get Busy Spin at Time 0

VLSI DV Interview Puzzles · All levels

try_get Busy Spin at Time 0

No deadlock occurs, but simulation appears frozen at t=0. Explain root cause and proper fix.

On this page

    Puzzle

    Difficulty: Easy · Puzzle 3 of 6 · Topic: Semaphore & Mailbox Puzzles

    No deadlock occurs, but simulation appears frozen at t=0. Explain root cause and proper fix.

    Code

    tb.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    module tb;
      mailbox #(int) mb = new();
      int item;
      initial begin
        forever begin
          if (!mb.try_get(item)) begin
            // no delay, no event wait
          end
        end
      end
    endmodule

    Hint

    A non-blocking API still needs timing control in polling loops.

    Step-by-step solution

    Diagram
    1) try_get returns immediately when mailbox empty.
    2) Loop has no blocking statement or delay.
    3) Process consumes simulator cycles in same time slot, often stuck at t=0.
    4) Add blocking get, wait event, or small delay/backoff in empty case.

    Answer

    Answer: This is a zero-delay busy spin, not a protocol deadlock. Add wait/delay or switch to blocking get.

    Why candidates get it wrong

    Non-blocking call does not imply low-overhead loop by itself.

    Interviewer follow-up

    What backoff policy would you use to avoid both starvation and performance collapse?

    Related topics

    • Back to Semaphore & Mailbox Puzzles

    • Concurrency & Timing Puzzles section

    Previous

    75 / 210

    Next: Leaked Semaphore Token on Error Path

    Up next

    Up nextLeaked Semaphore Token on Error Path

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Lock Held Across Blocking Response Wait
    • Two Consumers Waiting on One Mailbox
    • Deadlock-Free Request Loop with try_put/try_get