Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

ARQ Protocols: Stop-and-Wait, Go-Back-N & Selective Repeat

Lesson 8 of 15 in the free Computer Networks notes on Siksha Sarovar, written by Rohit Jangra.

ARQ Protocols: Stop-and-Wait, Go-Back-N & Selective Repeat

Automatic Repeat reQuest (ARQ) is an error-control mechanism for reliable data delivery at the Data Link layer. When the receiver detects an error (via CRC) or a frame is lost, it requests retransmission.

---

1. Data Link Layer Framing

Before discussing ARQ, understand how frames are delimited:

MethodHow It WorksExample
Character countFirst field in header gives frame lengthSimple but fragile if header corrupted
Flag bytesSpecial byte 01111110 marks start/end; stuffing prevents false flagsHDLC
Bit stuffingSender inserts a 0 after five consecutive 1s; receiver removes itHDLC, PPP
Byte stuffingSpecial escape byte inserted before any flag byte in dataPPP, SLIP

---

2. Stop-and-Wait ARQ

The simplest ARQ protocol.

How It Works

  1. Sender transmits one frame and starts a retransmission timer
  2. Sender waits for an ACK (acknowledgement) from the receiver
  3. If ACK received before timeout → send next frame
  4. If timeout before ACK → retransmit the same frame
  5. If receiver gets NAK (negative acknowledgement) → retransmit immediately

Efficiency Analysis

For a link with propagation delay Tp and transmission time Tt:

  • Bandwidth-delay product = Tt / (Tt + 2 × Tp) = 1 / (1 + 2a) where a = Tp / Tt

Example: Satellite link, Tt = 1 ms, Tp = 270 ms (round trip = 540 ms)

  • a = 270 / 1 = 270
  • Efficiency ≈ 1 / (1 + 2×270) ≈ 0.18% — catastrophically inefficient!

Solution: Use sliding window protocols (Go-Back-N or Selective Repeat) to keep multiple frames "in flight."

Stop-and-Wait Characteristics

FeatureDetail
Sequence numbers needed1 bit (0 and 1) — alternates
Sender window size1
Receiver window size1
EfficiencyVery low on high-latency links
ImplementationSimple
Exam Tip: Stop-and-Wait requires only 1-bit sequence numbers (alternating bit protocol). Efficiency = 1 / (1 + 2a). For low bandwidth-delay product links it's acceptable; for high-latency links like satellite, it wastes 99%+ of bandwidth.

---

3. Sliding Window Protocol

Sliding window allows the sender to have multiple frames outstanding (unacknowledged) simultaneously — the "window" of frames in flight.

Window Size Concepts

  • Sender window (Ws): Maximum frames sender can have unacknowledged
  • Receiver window (Wr): Maximum frames receiver will accept out of order
  • Sequence number space: Must be large enough for both windows

---

4. Go-Back-N (GBN) ARQ

How It Works

  1. Sender transmits frames continuously within its window
  2. Receiver accepts frames in order only
  3. If frame N is in error/lost:
  • Receiver discards frame N and all subsequent frames
  • Sends NAK N (or stops sending ACKs)
  • Sender goes back and retransmits frame N and all subsequent frames

GBN Window Sizes

  • Sequence number bits: n
  • Sender window: Ws = 2^n − 1
  • Receiver window: Wr = 1 (accepts only in-order frames)
  • Example: n=3 bits → Ws = 7, sequence numbers 0–7

Efficiency

  • With window size W and bandwidth-delay parameter a:
  • If W ≥ 2a + 1: Efficiency = 1 (100%)
  • If W < 2a + 1: Efficiency = W / (2a + 1)

GBN Characteristics

FeatureDetail
Sequence numbersn bits → 2^n − 1 max sender window
Retransmission on errorFrame N + all subsequent frames (wasteful)
Buffer at receiverNot needed (in-order only)
EfficiencyModerate — wasted on error recovery
ComplexityModerate

---

5. Selective Repeat (SR) ARQ

How It Works

  1. Sender transmits frames within its window (same as GBN)
  2. Receiver accepts frames out of order and buffers them
  3. If frame N is in error/lost:
  • Receiver sends NAK N / SREJ (Selective Reject)
  • Sender retransmits only frame N — not subsequent frames
  1. Once frame N arrives correctly, receiver delivers buffered frames in order

SR Window Sizes

  • Sequence number bits: n
  • Sender window: Ws = 2^(n−1)
  • Receiver window: Wr = 2^(n−1)
  • Example: n=3 → Ws = Wr = 4, sequence numbers 0–7
  • Why smaller window than GBN? To ensure receiver can always distinguish old frames from new frames correctly

SR Characteristics

FeatureDetail
Sequence numbersn bits → max window = 2^(n−1)
Retransmission on errorFrame N only
Buffer at receiverRequired (buffers out-of-order frames)
EfficiencyHighest — only retransmits what's necessary
ComplexityHighest

---

6. ARQ Protocol Comparison Table

FeatureStop-and-WaitGo-Back-NSelective Repeat
Sender window12^n − 12^(n−1)
Receiver window112^(n−1)
Retransmit on error1 frameFrame N + all afterFrame N only
Receiver buffer11Large buffer needed
Sequence bits1 bitn bitsn bits
EfficiencyVery lowModerateHigh
ComplexitySimplestModerateMost complex
Best forLow BDP linksGeneral useHigh BDP, noisy links
Exam Tip: Sender window sizes: Stop-and-Wait = 1, GBN = 2^n − 1, SR = 2^(n-1). The SR window is half the GBN window — crucial distinction. SR is more efficient because it only retransmits erroneous frames, not all subsequent frames.

---

Study Deep: ARQ in Modern Networks

  • TCP uses a form of Selective Repeat: TCP's selective acknowledgement (SACK) option allows the receiver to report non-contiguous received data, so the sender only retransmits missing segments — exactly like Selective Repeat.
  • Wi-Fi uses ARQ at Layer 2: 802.11 (Wi-Fi) uses its own ARQ at the MAC layer — every frame must be acknowledged, with automatic retransmission on loss.
  • Why Go-Back-N is rarely used in practice: The wasted bandwidth from retransmitting non-erroneous frames makes it uncompetitive with Selective Repeat on any link where errors are non-trivial. GBN is mainly taught for academic comparison.
  • HDLC (High-level Data Link Control): The standard Data Link layer protocol that implements sliding window ARQ. PPP (Point-to-Point Protocol) over phone lines also uses HDLC framing.