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 Course
  • Reading Paths
  • Concept Map
  • How to Read the Diagrams
  • Part 0: What Is a Protocol?10
  • Part 1: Timing and Clocking11
  • Part 2: Encoding and Framing12
  • Part 3: Handshakes13
  • Part 4: Flow Control17
  • Part 5: Transactions19
  • Part 6: Concurrency and Performance17
  • Part 7: Ordering13
  • Part 8: Sharing and Arbitration12
  • Part 9: Deadlock and Liveness13
    • Deadlock, Livelock and Starvation
    • Deadlock Conditions and Graphs
    • Channel Dependencies
    • Message-Dependent Deadlock
    • The Consumption Assumption
    • Routing Deadlock
    • Pre-allocation or Retry
    • Retry Livelock
    • Timeouts and Watchdogs
    • Hang Debug
    • Proving Deadlock Freedom
    • Protocols Compared: Deadlock and Liveness
    • Drills: Deadlock and Liveness
  • Part 10: Reliability and Recovery20
  • Part 11: Bring-Up and Link Management10
  • Part 12: Power8
  • Part 13: Shared State and Coherence9
  • Part 14: Security and Isolation7
  • Part 15: Specifying and Verifying11
  • Part 16: Protocols Dissected17
  • Part 17: Capstones5
  • Part 18: Interview Preparation6
Loading lesson

‹Part 9: Deadlock and Liveness
  1. Topics
  2. First Principles of Hardware Protocols
  3. Part 9: Deadlock and Liveness
  4. Deadlock, Livelock and Starvation

Part 9 · Deadlock and Liveness · Working (W)

Deadlock, Livelock and Starvation

Three different ways a system stops making progress: deadlock (nothing moves), livelock (everything moves, nothing completes) and starvation (some make progress, one never does). How each looks on a waveform and what usually causes it.

On this page

    Note

    Level: Working (W) · Answers: Why can it hang?

    Before this: Fairness and Starvation

    Three bug reports arrive on the same day, all titled "system hangs". In the first simulation, every valid signal is high, every ready is low, and nothing has changed for a million cycles. In the second, the bus is busy every single cycle, with retries and NAKs flying, yet no transaction finishes. In the third, everything runs normally, except that one DMA engine has been waiting for its first grant for 40,000 cycles. Three different diseases, one symptom.

    What are the different ways a system can stop making progress, and how do you tell them apart?

    The obvious answer, and why it breaks

    The obvious diagnosis for "it hangs" is deadlock, and the obvious fix is to look for the cycle of waits. But only one of the three reports above is a deadlock. Chasing a cycle in the second (where nothing waits for long, everything retries) or the third (where most of the system is fine) wastes days. Liveness has three failure modes, and each has its own signature and its own causes.

    The idea: three failures of progress

    Failure

    What happens

    On a waveform

    Typical cause

    Deadlock

    A set of agents each wait for another in the set; none can move

    Everything frozen: valids high, readies low, no handshakes, no state changes

    A cycle of dependencies: shared buffers, forbidden channel waits, cyclic routes

    Livelock

    Agents keep acting, but no one completes useful work

    Busy: handshakes, retries, NAKs every cycle, but completion counters stop rising

    Retry without reservation, symmetric back-off, repeated collisions

    Starvation

    Most of the system progresses; one agent never does

    Normal traffic everywhere; one requester's valid high for ever, never granted

    Unfair arbitration, priority without limits, lost wake-ups

    A useful question splits them quickly: is anything completing? Nothing completes and nothing moves: deadlock. Nothing completes but things move: livelock. Things complete, but not for one agent: starvation.

    How to tell them apart in simulation

    • Count completions (responses, retired transactions) over time, per agent. Flat for everyone: deadlock or livelock. Flat for one: starvation.

    • Count handshakes, including retries and rejections. Zero: deadlock. Busy: livelock.

    • For deadlock, build the wait-for graph: who holds what, who waits for what (lessons 9.2 and 9.10).

    • For livelock, look at the retry path: what is rejected, why, and whether anything guarantees the retry will succeed (lesson 9.8).

    • For starvation, look at the arbiter on the starved agent's path and its fairness bound (lesson 8.3).

    What breaks

    A team (illustrative) spent a week looking for a dependency cycle in a "hang" that turned out to be livelock: two requesters kept colliding on a shared resource, each backing off by exactly the same fixed delay, and colliding again. Completion counters had stopped, but the bus was 100% busy, the signature of livelock, not deadlock. Randomising the back-off fixed it in an hour once the right question was asked.

    Why this matters

    Senior lens. Instrument every design for liveness from the start: per-agent completion counters, retry and rejection counters, and a watchdog that, when it fires, dumps the state needed to build a wait-for graph. Then the first triage question, "is anything completing, and is anything moving?", is answered in minutes rather than days.

    Interview

    Asked: "Livelock vs deadlock: how do you tell them apart in simulation?"

    Weak answer: They're the same thing.

    Strong answer: Both stop useful progress, but a deadlock is frozen: no handshakes, valids stuck high, nothing changes, because agents wait in a cycle. A livelock is busy: handshakes, retries or NAKs every cycle, but completion counters stop rising. So I check completions and activity per agent: no completions and no activity is deadlock, no completions with activity is livelock, and completions for everyone except one agent is starvation. Then for deadlock I build the wait-for graph; for livelock I look at the retry mechanism.

    Follow-ups: (1) What causes livelock? (2) How would you instrument a design to tell them apart quickly?

    Check yourself A simulation shows the bus busy every cycle with NAKs and retries, but no transaction has completed for 100,000 cycles. Which failure?

    Livelock: things move, nothing completes.

    Check yourself Everything completes normally except one requester that is never granted. Which failure, and where do you look first?

    Starvation; look at the arbiter on its path and its fairness bound.

    Key takeaways

    • Deadlock: frozen in a cycle of waits. Livelock: busy, no completions. Starvation: everyone progresses but one.

    • Ask first: is anything completing, and is anything moving?

    • Instrument completions, retries and a state-dumping watchdog from the start.

    Keep going

    Next: Lesson 9.2, Deadlock Conditions and Graphs. The four conditions for deadlock, wait-for graphs, and a cycle finder.

    Related topics

    • Part 9 overview: Deadlock and Liveness

    Previous

    129 / 234

    Next: Deadlock Conditions and Graphs

    Up next

    Up nextDeadlock Conditions and Graphs

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Channel Dependencies
    • Message-Dependent Deadlock
    • The Consumption Assumption