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
  • Part 10: Reliability and Recovery20
    • Error Models
    • Parity
    • Hamming Distance
    • CRC
    • ECC and SECDED
    • Forward Error Correction
    • Error Responses
    • Poison and Containment
    • ACK and NAK
    • Sequence Numbers
    • Replay Buffers
    • Go-Back-N or Selective Repeat
    • Idempotency and Safe Replay
    • Link-Level or End-to-End Protection
    • Error Classes and Reporting
    • Recovery and Degradation
    • Interface Protection and Safety
    • The Reliability Budget
    • Protocols Compared: Reliability and Recovery
    • Drills: Reliability and Recovery
  • 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 10: Reliability and Recovery
  1. Topics
  2. First Principles of Hardware Protocols
  3. Part 10: Reliability and Recovery
  4. ACK and NAK

Part 10 · Reliability and Recovery · Working (W)

ACK and NAK

Positive acknowledgements confirm what arrived; negative acknowledgements report what arrived damaged. What each detects, why reliable links use both plus a timer, and how cumulative acknowledgements cut their cost.

On this page

    Note

    Level: Working (W) · Answers: What if bits go wrong?

    Before this: CRC

    A link resends any packet whose acknowledgement has not arrived within 10 µs. A noise burst corrupts a packet; the receiver's CRC check fails and it discards the packet. The sender waits the full 10 µs before it learns anything. A second design has the receiver say "that one was bad" the moment its check fails, and the resend starts within a few hundred nanoseconds. Same error, thirty times faster recovery.

    How does a sender learn what arrived, and why use both positive and negative acknowledgements?

    The obvious answer, and why it breaks

    The obvious reliable link uses positive acknowledgements and a timer: the receiver acknowledges what arrived intact, and the sender resends anything not acknowledged in time. That works for every kind of failure, but recovery from the most common one, a corrupted packet, takes a whole timeout, which must be long enough to cover the worst-case round trip. Waiting for silence is slow when the receiver already knows what went wrong.

    The idea: ACK, NAK and a timer

    Signal

    Sent when

    Tells the sender

    Catches

    ACK (positive)

    A packet arrived intact (and in sequence)

    It may free that packet's copy (lesson 10.11)

    Successful delivery

    NAK (negative)

    A packet arrived damaged or out of sequence

    Resend now, from the right point

    Corrupted packets, fast

    Timer at the sender

    No ACK or NAK arrived in time

    Something was lost entirely: resend

    Lost packets and lost ACKs or NAKs

    Each covers a gap in the others. ACKs alone recover only by timeout. NAKs alone cannot report a packet that vanished, since the receiver never saw it, nor a NAK that was itself lost. The timer alone is slow. Together: NAKs make the common case fast, ACKs let the sender free its buffer, and the timer catches everything else.

    The NAK recovers the corrupted packet quickly; the timer recovers from the lost ACK; the receiver discards the duplicate it causes.

    Cumulative acknowledgements

    Acknowledging every packet separately costs bandwidth on the return path. Cumulative ACKs say "everything up to and including number n arrived", so one ACK covers many packets, and a lost ACK is repaired by the next one. NAKs are usually cumulative too: "everything up to n was good; resend from n + 1". Both need sequence numbers on packets (lesson 10.10).

    How real protocols chose

    Protocol

    Acknowledgement scheme

    PCI Express data link layer

    Each TLP has a 12-bit sequence number. ACK and NAK DLLPs acknowledge every TLP up to and including the given number; a NAK, or the replay timer expiring, causes a replay of all unacknowledged TLPs.

    TCP

    Cumulative acknowledgements with a retransmission timer, plus duplicate acknowledgements as a fast loss signal.

    DCLink (step 9)

    Cumulative ACK and NAK carrying the last good sequence number, and a replay timer.

    What breaks

    The opening link (illustrative) recovered only by timeout. Its timeout had to cover the worst-case round trip, including the receiver being busy, so every corrupted packet stalled the link for 10 µs. Adding NAKs made recovery from corruption take one short round trip; the timer stayed, for the rarer cases where a packet or acknowledgement was lost completely.

    Why this matters

    Senior lens. For any reliable link, check that each failure has a recovery path: corruption (NAK), complete loss of a packet (timer, or a NAK triggered by the next packet's sequence gap), loss of an ACK or NAK (timer, plus cumulative acknowledgement), and duplicates (sequence numbers). Then size the timer from the worst-case round trip and check how often it fires in normal operation; a timer that fires often is masking a missing NAK.

    Interview

    Asked: "Why have NAK at all if there is a timeout?"

    Weak answer: For redundancy.

    Strong answer: Speed. A timeout has to cover the worst-case round trip, so recovering by timeout is slow, and the most common failure, a corrupted packet, is something the receiver knows about the moment its CRC fails. A NAK tells the sender immediately, so recovery takes one short round trip. The timer is still needed for what NAKs can't report: a packet lost entirely, or a lost ACK or NAK. ACKs let the sender free its replay buffer; cumulative ACKs keep the return traffic small.

    Follow-ups: (1) Why can't NAKs alone make a link reliable? (2) What does a cumulative ACK do when one ACK is lost?

    Check yourself A packet is lost completely and the receiver never sees it. Which mechanism recovers it?

    The sender's timer, or a NAK the receiver sends when the next packet arrives with a gap in the sequence numbers.

    Check yourself Why does a resend after a lost ACK create a duplicate, and how is it handled?

    The receiver already had the packet; it recognises the repeated sequence number, discards it, and acknowledges again.

    Key takeaways

    • ACKs confirm arrival and free buffers; NAKs report damage at once; a timer catches total loss.

    • NAKs make the common case, corruption, fast; the timer covers lost packets and lost acknowledgements.

    • Cumulative acknowledgements with sequence numbers reduce return traffic and repair lost ACKs.

    Keep going

    Next: Lesson 10.10, Sequence Numbers. Detecting loss and duplication with sequence numbers, and how many bits they need.

    Related topics

    • Part 10 overview: Reliability and Recovery

    Previous

    150 / 234

    Next: Sequence Numbers

    Up next

    Up nextSequence Numbers

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Error Models
    • Parity
    • Hamming Distance