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. Routing Deadlock

Part 9 · Deadlock and Liveness · Senior (S)

Routing Deadlock

In a network, packets hold buffers while waiting for the next link. When those waits form a cycle around a ring or a mesh, the network deadlocks. How it happens, and the three standard fixes: turn restrictions, datelines and escape channels.

On this page

    Note

    Level: Senior (S) · Answers: Why can it hang?

    Before this: Routing, Deadlock Conditions and Graphs

    A four-node ring network carries packets clockwise. Each node has a buffer for packets arriving from its neighbour. Under heavy traffic, every node's buffer fills with a packet that needs to move on to the next node, whose buffer is also full. Every packet waits for space that only the next packet can free by moving. The ring has no faulty part, and it has stopped.

    How do networks deadlock through their buffers, and how is it prevented?

    The obvious answer, and why it breaks

    The obvious defence is bigger buffers: if packets have more room, they will not get stuck. Bigger buffers make the deadlock rarer, not impossible: a burst big enough still fills every buffer around the cycle. The problem is the shape of the dependencies, not their size. As long as a packet holding a buffer can wait for a buffer that, through a chain, waits for it, deadlock is possible.

    The idea: cyclic buffer dependencies

    A ring in which every buffer is full of a packet that needs the next node's buffer: a cycle of waits, and a deadlock.

    Draw a channel dependency graph: one node per buffer (or virtual channel), an arrow from buffer X to buffer Y if a packet in X can wait for Y. Routing deadlock is possible exactly when this graph has a cycle. A ring's graph is a cycle by construction; a mesh's has cycles if packets can turn in every direction.

    Three standard fixes

    Fix

    How it breaks the cycle

    Where used

    Turn restrictions

    Forbid enough turns that no cycle can form; XY routing forbids all turns from Y back to X (lesson 8.9)

    Meshes

    Dateline (extra virtual channel)

    Packets start on VC 0 and move to VC 1 when they cross a chosen point (the dateline); no packet goes from VC 1 back to VC 0, so the cycle is cut into a line

    Rings and tori

    Escape channel

    Packets may route adaptively on some VCs, but can always fall back to an escape VC that follows a deadlock-free route; a stuck packet always has a way out

    Adaptive routing

    The dateline is the classic ring fix: on a 4-node ring with the dateline between node 3 and node 0, a packet travelling from node 2 to node 1 uses VC 0 for 2→3, then VC 1 for 3→0 and 0→1. The dependency graph is VC 0 links → VC 1 links, which ends; nothing points back from VC 1 to VC 0.

    How real systems chose

    Network

    Routing-deadlock fix

    On-chip meshes

    XY (dimension-order) routing: turn restrictions, no extra VCs needed.

    Rings and tori

    A dateline with two virtual channels per direction.

    Adaptive networks

    Escape virtual channels with a deadlock-free routing function underneath.

    These fixes cover routing deadlock only. Message-dependent deadlock (lesson 9.4) needs separate classes in addition: a ring with a dateline and requests and responses on the same VCs can still deadlock through the protocol.

    What breaks

    A ring network (illustrative) was designed with large buffers and no dateline, on the reasoning that with 16 entries per node "it would never fill". It passed months of simulation with realistic traffic and deadlocked in the lab under a stress test that sent every node's traffic two hops clockwise at once. Adding a dateline VC fixed it; the buffers could then be made smaller.

    Why this matters

    Senior lens. Never accept "the buffers are big enough" as a deadlock argument. Draw the channel dependency graph for the routing function and show it is acyclic (turn restrictions, dateline, or an escape channel with an acyclic graph), then check message classes separately on top. Stress-test with traffic patterns built to fill cycles: every node sending the same number of hops in the same direction at once.

    Interview

    Asked: "How does a ring network deadlock?"

    Weak answer: When a link fails.

    Strong answer: Packets hold a buffer at one node while waiting for space at the next, and in a ring the next eventually leads back to the first. Under enough load every buffer fills with a packet waiting for the next node, and nothing can move: a cycle in the channel dependency graph. Bigger buffers only make it rarer. The standard fix is a dateline: two virtual channels, packets switch from VC 0 to VC 1 when they cross a fixed point and never back, which turns the cycle into a line.

    Follow-ups: (1) Why doesn't XY routing need a dateline in a mesh? (2) What is an escape channel?

    Check yourself Why don't bigger buffers make a ring deadlock-free?

    The dependency cycle is still there; a large enough burst can still fill every buffer around it, so deadlock becomes rarer, not impossible.

    Check yourself On a ring with a dateline between node 3 and node 0, which VC does a packet from node 1 to node 3 use?

    VC 0 throughout: it never crosses the dateline.

    Key takeaways

    • Routing deadlock is a cycle of packets holding buffers while waiting for the next one.

    • It is possible exactly when the channel dependency graph has a cycle; buffer size does not change that.

    • Fix it with turn restrictions, a dateline VC, or escape channels, and handle message classes separately on top.

    Keep going

    Next: Lesson 9.7, Pre-allocation or Retry. Reserve the buffer before sending, or reject and retry: two ways to avoid holding while waiting.

    Related topics

    • Part 9 overview: Deadlock and Liveness

    • Architecture course: XY Routing and Deadlock

    Previous

    134 / 234

    Next: Pre-allocation or Retry

    Up next

    Up nextPre-allocation or Retry

    Sign in to save progress

    Practice this lessonReport an error

    See also

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