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. Pre-allocation or Retry

Part 9 · Deadlock and Liveness · Principal (P)

Pre-allocation or Retry

Two ways to keep a request from holding resources while it waits: reserve everything before sending (pre-allocation), or let the target reject it and have it retry. Their costs, and why modern protocols combine retry with a protocol credit.

On this page

    Note

    Level: Principal (P) · Answers: Why can it hang?

    Before this: The Consumption Assumption, Credit-Based Flow Control

    A home node in a coherent fabric has 64 tracker entries for transactions in progress. Hundreds of requesters may send it requests at any moment. If requests that find the trackers full wait in the fabric, they hold link buffers and block other traffic, which can include the responses that would free the trackers. If they are rejected instead, they come back, and may be rejected again, for ever. Both simple answers fail.

    How should a target handle more requests than it has room for, without deadlock or endless retries?

    The obvious answer, and why it breaks

    One obvious answer is to queue: requests wait in the fabric until the target has room. That is hold and wait (lesson 9.2): waiting requests hold buffers, and if what they block includes traffic the target needs to free its resources, the system can deadlock. The other obvious answer is to reject: the target refuses requests it cannot take and the requester tries again. That avoids holding while waiting, but nothing guarantees the retry ever succeeds.

    The idea: two strategies, and a combination

    Strategy

    How

    Strength

    Weakness

    Pre-allocation

    The requester reserves the target resource before sending (credits for target trackers, buffer space for the response)

    No request ever waits in the fabric; no retries

    The requester must hold credits for every target it might use: expensive with many targets

    Retry (reject)

    The target accepts if it can, otherwise rejects; the requester resends later

    No credits needed in advance; scales to many requesters and targets

    Wasted attempts; no guarantee of progress (livelock, lesson 9.8)

    Retry plus protocol credit

    A rejected requester is remembered; when space frees, the target grants a credit to it; the retry with that credit is guaranteed to be accepted

    No holding while waiting, no endless retries, no credits needed in advance

    The target keeps a list of who it owes a credit

    The first attempt is rejected; the target later reserves a tracker for this requester and grants a credit; the retried request is guaranteed to be accepted.

    Why link credits are not enough

    Link-level credits (Part 4) guarantee a request has room in the next buffer on the link. They say nothing about whether the destination has a tracker for it. Pre-allocating destination resources from every requester to every target would need credits for every pair, which does not scale. Retry with a protocol credit gets the guarantee only when it is needed: after a rejection.

    How real protocols chose

    Protocol

    Approach

    AMBA CHI

    A home node without tracker space answers a request with a retry (RetryAck) and later sends a protocol credit (PCrdGrant); the retried request, carrying that credit, is guaranteed to be accepted. Link credits separately guarantee space on each link.

    PCI Express

    Pre-allocation through credits for each traffic type at each link (Part 4), plus endpoints reserving space for completions before issuing reads (lesson 9.5).

    Original AHB

    Plain retry (RETRY and SPLIT responses) without a credit guarantee; AHB-Lite dropped them (lesson 9.8).

    What breaks

    A fabric (illustrative) used plain retry at a busy home node. Under contention, some requesters were rejected thousands of times in a row because others' retries happened to arrive just as each tracker freed. Adding a list of rejected requesters and reserving freed trackers for them in order, a protocol credit, bounded every requester's wait to one rejection plus its turn in the list.

    Why this matters

    Principal lens. Decide, for every shared target, how requests that cannot be accepted are handled: wait in the fabric (and prove that waiting cannot close a cycle), pre-allocate (and show the credit count scales), or retry (and show what guarantees eventual acceptance). Plain retry without a guarantee is a livelock risk; retry plus a protocol credit is the pattern modern coherent protocols settled on for good reason.

    Interview

    Asked: "Why does CHI use retry plus a protocol credit?"

    Weak answer: To save buffers.

    Strong answer: Because both simple options fail at scale. Waiting in the fabric is hold-and-wait: blocked requests occupy link buffers and can block the traffic that frees the home node's trackers, risking deadlock. Pre-allocating trackers needs credits from every requester to every home node, which doesn't scale. Plain retry avoids holding but can starve a requester for ever. So CHI rejects with a retry, remembers the requester, and when a tracker frees grants it a protocol credit; the retried request with that credit is guaranteed to be accepted. Link credits only cover the link, not the destination.

    Follow-ups: (1) Why aren't link-level credits enough? (2) What state does the home node keep?

    Check yourself Why is waiting in the fabric a deadlock risk?

    Waiting requests hold link buffers (hold and wait); if the traffic they block includes what the target needs to free its resources, a cycle forms.

    Check yourself With retry plus protocol credit, how many times can one request be rejected?

    Once: after the rejection, the target reserves a resource for that requester and grants a credit, and the retry with the credit is accepted.

    Key takeaways

    • Waiting in the fabric holds resources while waiting; pre-allocation reserves first; retry rejects and resends.

    • Pre-allocation does not scale to many targets; plain retry can livelock.

    • Retry plus a protocol credit guarantees acceptance after at most one rejection, without holding or pre-allocating.

    Keep going

    Next: Lesson 9.8, Retry Livelock. Retry storms that never make progress, and the fixes: back-off, reservation and ageing.

    Related topics

    • Part 9 overview: Deadlock and Liveness

    Previous

    135 / 234

    Next: Retry Livelock

    Up next

    Up nextRetry Livelock

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Deadlock, Livelock and Starvation
    • Deadlock Conditions and Graphs
    • Channel Dependencies