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 Course
  • Reading Paths
  • Glossary
  • Metrics Reference
  • Formal Cheat Sheet
  • Formal Foundations19
  • Properties and SVA16
  • Property Development and Constraints19
  • Proof Engines and Convergence23
  • Formal Applications20
    • Connectivity Checking
    • Register (CSR) Verification
    • Deadlock, Livelock and Starvation Checks
      • Deadlock, Livelock, Starvation Defined
      • Arbiter Grant Latency Proof
      • Progress in a Handshake Chain
      • Fairness Assumptions for Progress Proofs
    • Reset Determinism and X
    • Data, Handshake and Pipeline Property Sets
    • Other Applications, Honestly Scoped
  • Equivalence Checking14
  • Formal Coverage and Signoff15
  • Methodology and Debug13
  • Interview Prep15
  • Capstone: A Chip-Block Verification Lab24
Loading lesson

←Deadlock, Livelock and Starvation Checks
  1. Topics
  2. Formal Verification
  3. Formal Applications
  4. Deadlock, Livelock and Starvation Checks
  5. Deadlock, Livelock, Starvation Defined
On this page

    Part 5 of 10, lesson 8 of 20Part 5 of 10/Formal Applications/Lesson 8 of 20All levels

    Deadlock, Livelock, Starvation Defined

    No possible progress, activity without completion, and one victim denied while others are served, with structural and temporal evidence for each.

    Why it matters

    The bug report says the system hung. The engineer adds a timeout, the timeout fires, the hang is declared fixed, and the real defect, a structural cycle through a shared slave, waits for the next configuration. The timeout treated a deadlock as a performance problem. Naming the failure correctly decides the evidence: deadlock is argued on the dependency graph and shown as a stuck state, livelock as activity with no completion, starvation as service for everyone but one.

    The core idea

    Deadlock means no progress is possible: each party waits for another in a cycle, so the system is stuck. The argument is structural, on the wait-for graph, and the temporal evidence is a reachable state with no enabled progress. Livelock means there is activity but no completion: parties keep moving, for example retrying against each other, and the completion counter never advances. Starvation means one requester is never served while others are: the system progresses, the victim does not. Circular wait is structural; absence of progress is temporal; a liveness counterexample, where the engine supports one, is a lasso, a finite prefix that reaches a loop round which the victim never wins.

    Failure

    Structural sign

    Temporal sign

    Arbiter example

    Handshake chain example

    Retry example (illustrative)

    Deadlock

    cycle in the wait-for graph

    stuck state, nothing enabled

    grants withheld while requests are high (the arbiter proves it cannot: any request implies a grant)

    valid waits for ready and ready waits for valid (next lessons)

    two masters each hold one lock and wait for the other's

    Livelock

    no cycle, retries possible

    traffic with no completion

    the granted requester drops and re-requests every cycle, no transfer completes

    a stage keeps reissuing a beat that is never accepted

    two masters keep retrying a transaction that a third keeps aborting

    Starvation

    priority stuck on one side

    others served, one waits

    pointer frozen when requester 0 wins: requesters 1 to 3 starve (next lesson)

    an upstream with priority always takes the shared stage

    a retry loop that always loses to newer requests

    A top-down graph with two nodes. Stage 1 has an arrow to stage 2 labelled waits for, and stage 2 has an arrow back to stage 1 with the same label, closing a cycle.
    A wait-for graph with the closing edge drawn: stage 1 waits for stage 2 and stage 2 waits for stage 1.

    Worked example: finding the cycle

    The checker below builds wait-for graphs for three small systems and reports cycles. The third graph carries an injected extra edge that closes a cycle, and the checker names it; the first two pass clean. The check is small, but every clause in it can fail: remove the cycle detection and the injected edge passes silently, which the assertions below guard against. The next lesson runs the same search on the real handshake lines of a chain:

    example.py
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    def find_cycle(edges):
        WHITE, GREY, BLACK = 0, 1, 2
        colour = {}
        def visit(node, stack):
            colour[node] = GREY
            for nxt in edges.get(node, []):
                if colour.get(nxt, WHITE) == GREY:
                    return stack + [nxt]
                if colour.get(nxt, WHITE) == WHITE:
                    hit = visit(nxt, stack + [nxt])
                    if hit:
                        return hit
            colour[node] = BLACK
            return None
        for node in edges:
            if colour.get(node, WHITE) == WHITE:
                hit = visit(node, [node])
                if hit:
                    return hit
        return None
    
    arbiter_ok = {"r0": ["arb"], "r1": ["arb"], "r2": ["arb"], "r3": ["arb"], "arb": []}
    chain_ok = {"s1": ["s2"], "s2": ["sink"], "sink": []}
    chain_bug = {"s1": ["s2"], "s2": ["s1"], "sink": []}
    assert find_cycle(arbiter_ok) is None
    assert find_cycle(chain_ok) is None
    cycle = find_cycle(chain_bug)
    assert cycle is not None and cycle[0] == cycle[-1]
    assert "s1" in cycle and "s2" in cycle
    print("PASS: no cycle in arbiter or clean chain; injected s1-s2 cycle named")

    What the review looks for

    • The three terms are used with their definitions: a stuck system is not called starvation.

    • The wait-for graph is drawn for the actual configuration, including shared slaves and bridges.

    • The temporal evidence matches the claim: stuck state, completion counter, or per-requester waits.

    Verify and debug

    Classify first, measure second. If nothing moves, draw the graph and look for the cycle before adding timeouts. If traffic flows but a completion counter stalls, suspect livelock and look for the retry loop. If all but one requester progress, read that requester's wait counter, which the arbiter lesson proves bounded.

    A timeout sold as a fix for a deadlock: the symptom is the hang recurring under a new configuration, found when the wait-for graph is finally drawn and the cycle is still there. The cause is treating a structural defect as a performance tuning. The fix is breaking the cycle, then keeping the timeout only as a last-resort detector with its own cover.

    Expect: define all three without hand-waving. Answer in one sentence each, then give the evidence for each: the cycle on the graph for deadlock, the completion counter for livelock, the per-requester wait bound for starvation. Offer the arbiter wait bound as the worked number.

    Check yourself Two masters retry forever and no transfer completes, but the bus is busy every cycle. Which failure, and what proves it?

    Livelock: activity without completion. The proof is a completion counter that never advances despite the traffic, plus the retry loop identified as its cause. A timeout alone would only rename it.

    Related topics

    • Next: Arbiter Grant Latency Proof

    • Protocol FP: Deadlock, Livelock, Starvation

    • Protocol FP: Proving Deadlock Freedom

    Previous

    90 / 183

    Next: Arbiter Grant Latency Proof

    Up next

    Up nextArbiter Grant Latency Proof

    Sign in to save progress

    Practice this lessonPrevious lessonReport an error

    See also

    • Progress in a Handshake Chain
    • Fairness Assumptions for Progress Proofs