CS Atlas GATE 2027
Computer Networks course
0 / 90 complete

Computer Networks/Phase 4 · Transport Layer (TCP)

Lesson 4.2.1 · Item 62 of 90

Stop-and-Wait ARQ, 1-bit sequence numbers & link utilisation

Read at your own pace. Try the questions before opening the answers.

On this page

Recall warm-up

  1. What is the difference between best-effort delivery and reliable delivery?
    Stuck? Peek at 4.1 Transport basics: process-to-process delivery, ports, sockets & multiplexing
    • Delivery: Network Layer = host-to-host; Transport Layer = process-to-process.
    • Port number = 16 bits (0–65,535): Well-known 0–1023, Registered 1024–49151, Ephemeral 49152–65535.
    • Demultiplexing: UDP uses 2-tuple (DstIP, DstPort); TCP uses 4-tuple (SrcIP, SrcPort, DstIP, DstPort).
    • UDP (Foundation) = 8-byte header, connectionless, best-effort; TCP = connection-oriented, reliable, flow + congestion controlled.

    Read lesson 4.1

  2. From Lesson 1.3.3, what is the ratio a = T_p / T_t, and what is the utilisation of a send-and-wait cycle?
    Stuck? Peek at 1.3.3 RTT, bandwidth-delay product, utilisation and a = Tp/Tt
    • RTT = 2·Tp for tiny signals (add Tt / queuing if stated).
    • BDP = B × Tp bits in flight; B × RTT before any reply.
    • a = Tp / Tt.
    • Send-and-wait: U = Tt/(Tt + 2Tp) = 1/(1 + 2a); throughput = U·B.
    • To keep the link busy: about 1 + 2a units in flight.

    Read lesson 1.3.3

  3. How does a receiver detect whether an arriving frame/packet suffered bit flips on the link?
    Stuck? Peek at 2.2.4 CRC: generator polynomial, modulo-2 division, what CRC catches
    • G of degree r (r + 1 bits); append r zeros, divide modulo 2, send data + r-bit remainder.
    • Receiver divides the whole frame: remainder 0 → accept.
    • Undetected ⇔ error pattern E is a multiple of G.
    • Catches: all single-bit errors (≥ 2 terms), all odd counts (x + 1 | G), all bursts ≤ r; (r+1)-bursts missed w.p. 2⁻⁽ʳ⁻¹⁾, longer 2⁻ʳ.

    Read lesson 2.2.4

The Hook

In Lesson 1.3.3 we saw that sending one packet and waiting one round-trip time (RTT = 2·Tp) before sending the next has utilisation η = 1 / (1 + 2a). Now let's make that protocol reliable over a lossy network where packets and confirmations can vanish!

This protocol family is called ARQ (Automatic Repeat Request), and its simplest member — Stop-and-Wait ARQ — hides a famous subtle trap: why do we still need a 1-bit sequence number (0 and 1) when only one packet is in flight at a time?

Predict First

Suppose Sender A sends Data Packet, Receiver B receives it cleanly and sends back an ACK (acknowledgement), but the ACK is lost on the way back! Sender A's timer expires, so A retransmits the exact same Data Packet. If packets have NO sequence numbers, what mistake will Receiver B make?

,

Receiver B cannot tell whether this arriving packet is a retransmission of the old packet (whose ACK was lost) or a brand-new second packet! B will hand a duplicate copy of the data to the application! Stamping alternating 1-bit sequence numbers (0, 1, 0, 1, …) solves this completely.

Core Concept

The Four Ingredients of Stop-and-Wait ARQ

Stop-and-Wait ARQ achieves reliable delivery over an unreliable channel using four mechanisms:

  1. Error Detection (Checksum/CRC): Receiver silently discards (or sends a negative acknowledgement for) corrupted packets.
  2. Positive Acknowledgement (ACK): When an uncorrupted packet arrives, the receiver sends an ACK back to the sender.
  3. Timeout Timer & Retransmission: The sender starts a timer when transmitting a packet; if no ACK arrives before the timer expires, the sender retransmits the buffered packet.
  4. 1-bit Sequence Numbers (0 and 1): Packets alternate Seq = 0 and Seq = 1 so the receiver can detect and discard duplicate packets caused by lost or delayed ACKs!
SenderReceiverData (Seq = 0)✕ACK 0 (lost!)Timeout! Retransmit Seq = 0Data (Seq = 0) [duplicate]Sees Seq=0 again → discards duplicate data, re-sends ACK!ACK 0Data (Seq = 1) [next new packet]
Why 1-bit sequence numbers (0, 1) are mandatory: when ACK 0 is lost, Receiver recognises retransmitted Seq=0 as a duplicate!

Utilisation (Efficiency) & Throughput of Stop-and-Wait

Let packet length be L bits, link bandwidth be B bit/s, one-way propagation delay be Tp, and transmission time be Tt = L / B. In every cycle, the sender spends Tt putting bits on the link and then waits RTT = 2·Tp for the ACK:

Stop-and-Wait Utilisation (Efficiency) & Throughput:
η = Tt / (Tt + 2·Tp) = 1 / (1 + 2a), where a = Tp / Tt.
If ACK transmission time Tack and processing delay Tproc are explicitly given:
η = Tt / (Tt + 2·Tp + Tack + Tproc).
Effective Throughput (Goodput) = η × B = L / (Tt + 2·Tp) bits/sec.
Sender
Tx (Tₜ=2)Idle waiting for ACK (2·Tₚ = 18)Next Tx
05101520
time (ms)
Stop-and-Wait timeline for Tₜ = 2 ms, Tₚ = 9 ms (a = 4.5): useful transmission is only 2 ms out of every 20 ms cycle (η = 10%)!

Delayed Duplicate ACKs & Why Alternating 0/1 Works

What if an ACK is not lost, just delayed past the timeout? If the receiver replies with ACK 0 (acknowledging Seq 0, or equivalently ACK 1 meaning "I next expect Seq 1"), the sender knows which packet the ACK belongs to and ignores a late duplicate ACK for an already-acknowledged packet.

Failure ScenarioWhat would go wrong WITHOUT Seq 0/1?How 1-bit Seq (0, 1) fixes it
Data 0 is lostNothing (timer expires, sender resends Data 0)Receiver was still waiting for Seq 0 → accepts it cleanly
ACK for Data 0 is lostReceiver mistakes retransmitted Data 0 for Data 1 (DUPLICATE!) Receiver expects Seq 1, sees Seq 0 → discards duplicate, resends ACK
ACK for Data 0 is delayed past timeoutSender mistakes late ACK 0 for ACK of Data 1!Numbered ACKs (ACK 0 vs ACK 1) prevent mismatched ACKs
Every failure case handled by 1-bit sequence numbers in Stop-and-Wait ARQ.

Putting it together

  • Stop-and-Wait ARQ adds ACKs, timeouts, retransmissions, and 1-bit sequence numbers (0, 1) to make send-and-wait reliable.
  • The 1-bit sequence number is essential to prevent duplicate delivery when an ACK is lost.
  • Because only 1 packet is sent per cycle T_t + 2·T_p, link utilisation is 1 / (1 + 2a), which is very poor when a = T_p / T_t is large.

Visual

028.2556.584.75113012481610033.32011.15.93Ratio a = Tₚ / TₜEfficiency η (%)
As the bandwidth-delay product (a = Tₚ / Tₜ) grows, Stop-and-Wait efficiency collapses as 1 / (1 + 2a).

Worked Examples

Easy

A link has transmission delay Tt = 5 ms and one-way propagation delay Tp = 20 ms. Find the ratio a and the link utilisation η of Stop-and-Wait ARQ (ignoring ACK size and processing).

Show the full solution

a = Tp / Tt = 20 / 5 = 4.
η = 1 / (1 + 2a) = 1 / (1 + 8) = 1/9 ≈ 11.11%.

Medium

A 10 Mbps link has one-way propagation delay Tp = 4.5 ms. Packets are 10,000 bits long. Using Stop-and-Wait ARQ, what are the link utilisation and the effective throughput in Mbps?

Show the full solution

First find Tt = L / B = 10,000 bits / (10 × 10⁶ bit/s) = 10⁻³ s = 1 ms.
Then a = Tp / Tt = 4.5 / 1 = 4.5.
Utilisation η = 1 / (1 + 2 × 4.5) = 1 / 10 = 0.10 (10%).
Effective throughput = η × B = 0.10 × 10 Mbps = 1 Mbps (or directly 10,000 bits / 10 ms = 10⁶ bit/s = 1 Mbps).

GATE

A Stop-and-Wait protocol sends data frames of 2000 bits over a 1 Mbps link with one-way propagation delay Tp = 9 ms. Each ACK frame is 1000 bits long. What is the link utilisation for data?

Show the full solution

Here ACK size is explicitly given, so we must include Tack in the cycle time!
• Tt = 2000 / 10⁶ = 2 ms.
• Tack = 1000 / 10⁶ = 1 ms.
• Total cycle time = Tt + 2·Tp + Tack = 2 + 2(9) + 1 = 21 ms.
• Useful data transmission time = Tt = 2 ms.
• Utilisation η = 2 / 21 ≈ 9.52%.

GATE Traps

  • Forgetting the factor of 2 on Tp: The packet must travel forward (Tp) AND the ACK must travel back (Tp), so the wait is RTT = 2·Tp!
  • Check if the question gives RTT or one-way Tp! If the question says "RTT = 20 ms", then 2·Tp = 20 ms already — do NOT multiply 20 ms by 2 again!
  • Packet loss increases total transmissions: If frame loss probability is p, expected transmissions per packet is 1 / (1 − p), so effective utilisation becomes (1 − p) / (1 + 2a).

Memory Hook

1 bit (0/1) catches twin packets when an ACK dies; Efficiency = Tₜ / (Tₜ + RTT) = 1 / (1 + 2a)!

Connect the Dots

Stop-and-Wait wasted 90% of our 10 Mbps link because the sender sat idle for 2·Tp waiting for one ACK. Next question (4.2.2): What if we allow the sender to keep up to N packets in flight at the same time before waiting for the first ACK?

Self-Test

  1. NAT

    In a Stop-and-Wait ARQ system, the transmission time of a data frame is 2 ms and the round-trip propagation time (2·T_p) is 18 ms (ignore ACK size and processing delay). What is the link utilisation in percent?

    Write your answer before opening the key.

  2. MCQ

    Why does Stop-and-Wait ARQ require a 1-bit sequence number (0 and 1) in each data frame?

    1. To allow the sender to transmit two frames before receiving an ACK.
    2. To allow the receiver to reorder frames that arrive out of order.
    3. To allow the receiver to distinguish a retransmitted duplicate frame (when an ACK was lost) from a new next frame.
    4. To calculate the round-trip propagation delay.
  3. NAT

    A 1 Mbps link has a one-way propagation delay of 12 ms. Data frames are 1000 bits long, and ACK frames are negligible in size. What is the maximum throughput (in kbps) achievable using Stop-and-Wait ARQ?

    Write your answer before opening the key.

  4. MSQ

    Which of the following changes will INCREASE the link utilisation η = 1 / (1 + 2·T_p / T_t) of a Stop-and-Wait protocol?

    1. Increasing the data frame length L (while keeping link rate B and distance d constant)
    2. Decreasing the physical link distance d
    3. Increasing the link data rate B (while keeping L and d constant)
    4. Increasing the signal propagation speed v on the medium

Rule Card

  • Stop-and-Wait ARQ: 1 packet in flight; uses 1-bit sequence numbers (0, 1) to discard duplicates when ACKs are lost.
  • Utilisation: η = Tt / (Tt + 2·Tp) = 1 / (1 + 2a), where a = Tp / Tt (with losses of prob p: (1 − p)/(1 + 2a)).
  • Throughput: η × B = L / (Tt + 2·Tp).

Concept Ledger

  • ARQ (Automatic Repeat Request)
  • ACK (acknowledgement)
  • timeout
  • retransmission
  • stop-and-wait ARQ
  • η = 1/(1+2a)
  • throughput = η·B
  • 1-bit sequence numbers
  • duplicate detection

Answer Vault

Try the questions first. Open when you are ready to check.

Warm-up answers

  1. Best-effort delivery may drop, corrupt, or reorder packets without recovery; reliable delivery guarantees every piece of data arrives intact, once, and in order.
  2. a is the ratio of propagation delay to transmission delay; send-and-wait utilisation is 1 / (1 + 2a).
  3. By recomputing the error-detection code (CRC at Layer 2 or Checksum at Layer 3/4).

Self-test answers

  1. 10 — η = T_t / (T_t + 2·T_p) = 2 / (2 + 18) = 2 / 20 = 0.10 = 10%.
  2. C — When an ACK is lost, the sender times out and retransmits the same frame; the 1-bit sequence number lets the receiver detect that it is a duplicate of the already-delivered frame rather than the next frame.
    • A: Stop-and-Wait only ever has 1 frame in flight.
    • B: With 1 frame in flight, frames cannot overtake each other.
    • D: Sequence numbers identify frames, not timestamps.
  3. 40 — T_t = 1000 bits / 10⁶ bit/s = 1 ms. Cycle time = T_t + 2·T_p = 1 + 2(12) = 25 ms. In 25 ms, 1000 bits are delivered → Throughput = 1000 bits / 25 ms = 40,000 bit/s = 40 kbps.
  4. ABD — Increasing L, decreasing d, or increasing propagation speed v all decrease a = T_p / T_t, which increases η = 1/(1+2a). Increasing B shrinks T_t = L/B, which INCREASES a and therefore DECREASES Stop-and-Wait utilisation!
    • C: Faster link rate B makes T_t smaller, so the sender finishes transmitting even faster and spends a larger fraction of time waiting for propagation!

Flashcards

  1. Formula for Stop-and-Wait link utilisation η in terms of a = T_p / T_t?
    Reveal answerη = 1 / (1 + 2a) = T_t / (T_t + 2·T_p).
  2. Why are 1-bit sequence numbers (0 and 1) needed in Stop-and-Wait?
    Reveal answerSo the receiver can tell a retransmitted duplicate (after a lost ACK) apart from the next new packet.
  3. What happens to Stop-and-Wait efficiency if link bandwidth B doubles while frame size L and distance d stay fixed?
    Reveal answerT_t halves, so a = T_p / T_t doubles and efficiency η = 1/(1+2a) DECREASES!
  4. If each packet is lost independently with probability p, what is the expected number of transmissions per packet?
    Reveal answer1 / (1 − p).

Exam shortcuts

  • Direct Throughput Formula (skipping η): Throughput = Packet Bits L / Total Cycle Time (Tt + 2·Tp). — when a GATE NAT question asks directly for throughput in kbps or Mbps.
  • Minimum sequence numbers for Stop-and-Wait: Always 2 sequence numbers (0 and 1 → 1 bit). — conceptual MCQs asking why 1 bit is needed.

Ready for the next idea?

Mark this item complete when you’ve finished reading and working through it.