COMPUTER NETWORKS/Student Engineering Notebook
Page 04·notes
FLOW CONTROL & SLIDING WINDOW PROTOCOLS—~26 MIN READ

Sliding Window: Stop-and-Wait, Go-Back-N & Selective Repeat

Optional link-layer protocol enrichment beyond the named GATE 2027 CS/IT network topics

“Window sizes, link efficiency eta = W / (1 + 2a), and timer retransmissions.”

1.The Stop-and-Wait Protocol & Fundamental Efficiency

In Stop-and-Wait ARQ, the sender transmits a single frame and halts until an acknowledgment (ACK) is received from the receiver. If a timer expires before the ACK arrives, the sender retransmits the frame.

Total Round-Trip Cycle Time T_cycle = T_t + 2 * T_p + T_proc + T_ack.

Assuming processing delay T_proc approx 0 and ACK frame transmission delay T_ack approx 0: T_cycle = T_t + 2 * T_p.

Link Efficiency (Utilization) eta = Useful Time / Total Time = T_t / (T_t + 2 * T_p) = 1 / (1 + 2a), where a = T_p / T_t = (Propagation Delay) / (Transmission Delay).

Throughput = eta Bandwidth = (Size of Frame) / (T_t + 2 T_p).

notice this:— Impact of High Bandwidth-Delay Product

On satellite links or high-speed fiber where propagation delay T_p is huge compared to transmission delay T_t (i.e., a >> 1), Stop-and-Wait efficiency collapses near 0%! Pipelined sliding window protocols are essential.

2. Sliding Window Architectural Comparison: GBN vs Selective Repeat

Detailed comparison of window bounds, receiver buffering, acknowledgment types, and retransmission behavior:

FeatureGo-Back-N (GBN)Selective Repeat (SR)
Sender Window Size (W_s)W_s <= 2^k - 1 (for k-bit sequence numbers)W_s <= 2^(k - 1)
Receiver Window Size (W_r)W_r = 1 (strictly accepts in-order only)W_r = W_s <= 2^(k - 1)
Window Sum ConditionW_s + W_r <= 2^k (W_s + 1 <= 2^k)W_s + W_r <= 2^k (W_s = W_r = 2^(k-1))
Out-of-Order FramesDiscarded completely (not buffered)Buffered in receiver window until gap is filled
Acknowledgment TypeCumulative ACK (ACK n confirms all frames <= n)Individual Selective ACK (NACK / SACK)
Retransmission on TimeoutRetransmits entire window of unacknowledged framesRetransmits ONLY the single lost frame
Hardware ComplexityLow (no receiver buffer needed)High (sorting buffer, individual timers per frame)
LABORATORY · INTERACTIVE SIMULATION —Concept Exploration

3. Lab: Watch Go-Back-N and Selective Repeat Handle a Lost Frame

Switch protocols, change the window size and a = T_p / T_t, and pick a frame to lose. The efficiency, sequence-bit count, and the exact frames on the wire update as you go.

Data Link Flow Control Simulator

Sliding Window Retransmission Lab

Model: one chosen frame is lost on its first transmission, ACKs are never lost, and the sender's window base is at the lost frame when its timer expires.

Efficiency η = min(1, Ws/(1+2a))80.0%
Ws for 100% use≥ 5 frames
Sequence bits neededk = 3
Transmissions12 (+4 resent)
Frames on the wire, in order
  1. 0 
  2. 1 
  3. 2lost
  4. 3discarded
  5. 4discarded
  6. 5discarded
  7. 2resent
  8. 3resent
  9. 4resent
  10. 5resent
  11. 6 
  12. 7 

Frame 2 is lost. The receiver accepts only in-order frames, so it discards frames 3–5. On timeout the sender goes back and resends frames 2–5.

WORKED EXAM ANALYSIS · STEP-BY-STEP DERIVATION

4. GATE Worked Numerical: 100% Link Utilization & Sequence Number Bits

⚠️ Pitfall Warning:

In Go-Back-N, if optimal window size is W, you need at least W + 1 distinct sequence numbers! Sequence bits k = ceil(log2(W + 1)). In Selective Repeat, k = ceil(log2(2 * W)).

Problem: A 1000 km link has bandwidth B = 100 Mbps and propagation speed s = 2 * 10^8 m/s. Frame size L = 1000 bytes. Find:

1. Stop-and-Wait efficiency.

2. Minimum sender window size W_s to achieve 100% link utilization.

3. Minimum sequence number bits required for GBN and Selective Repeat.

Step 1: Compute T_t and T_p:

T_t = (1000 8 bits) / (100 10^6 bps) = 8,000 / 100,000,000 = 0.08 ms = 80 microseconds.

T_p = Distance / Speed = 1000 10^3 m / (2 10^8 m/s) = 5 * 10^-3 s = 5 ms.

a = T_p / T_t = 5 ms / 0.08 ms = 62.5.

Step 2: Stop-and-Wait Efficiency eta = 1 / (1 + 2a) = 1 / (1 + 125) = 1 / 126 approx 0.00794 (0.79%).

Step 3: For 100% utilization: Efficiency eta = 1 => W_s >= 1 + 2a = 1 + 125 = 126 frames.

Step 4: Sequence number bits:

For Go-Back-N: Total sequence numbers N >= W_s + 1 = 126 + 1 = 127. k = ceil(log2 127) = 7 bits.

For Selective Repeat: Total sequence numbers N >= 2 W_s = 2 126 = 252. k = ceil(log2 252) = 8 bits.

WORKED NUMERICAL · STUDENT DERIVATION✎ Key Takeaway: Selective Repeat needs window ≤ 2^(k−1), so it would need 6 bits for a window of 21.

Worked example: how big must the window be?

Problem Statement:
A frame takes Tt = 1 ms to transmit and the propagation delay is Tp = 10 ms. Find stop-and-wait efficiency, the window size for full utilisation, and the sequence bits Go-Back-N needs.
Step 1: Ratio a

a = Tp / Tt.

10 / 1
↳ Result: a = 10
Step 2: Stop-and-wait efficiency

η = 1 / (1 + 2a).

1 / 21
↳ Result: ≈ 4.76%
Step 3: Window for 100%

Keep sending until the first ACK returns: 1 + 2a frames.

1 + 20
↳ Result: 21 frames
Step 4: Sequence bits for Go-Back-N

Go-Back-N needs window ≤ 2^k − 1, so 2^k ≥ 22.

k = ⌈log₂ 22⌉
↳ Result: 5 bits
Final Answer:4.76%; window 21; 5 sequence bits
STUDENT PRACTICE · CONCEPT DRILL

Practice: test yourself

Original practice questions in the GATE style, with worked explanations. Not past-paper questions.

Problem 1 · GATE-LEVEL

Selective Repeat with 4-bit sequence numbers. What is the largest window size?

Problem 2 · FOUNDATION

Go-Back-N with 4-bit sequence numbers. What is the largest window size?

Problem 3 · GATE-LEVEL

In Go-Back-N, frame 3 is lost and frames 4 to 6 arrive. What does the receiver do?

SOURCE TRANSPARENCY & CITATIONS

Primary Academic References & Exam Sources

Every concept in Notes From a B.Tech Brain is synthesized from authoritative academic texts, seminal peer-reviewed research, verified exam archives, and renowned university lectures.

Curated University Lecture Series
Data Communications and Networking (5th Edition) ·
LECTURE SERIES
RECOMMENDED YOUTUBE EDUCATORS & FULL-COURSE PLAYLISTS

Curated for clarity, rigorous numerical solving, and semester excellence:

Knowledge Gate · Computer Networks for GATE↗Instructor: Sanchit Jain · Covers: OSI/TCP-IP layers, sliding window, CRC, subnetting, TCP congestion control

GATE-level numerical drilling and PYQ analysis.

Open YouTube↗
Gate Smashers · Computer Networks Full Course↗Instructor: Varun Singla · Covers: Ethernet, IP addressing, routing algorithms, TCP/UDP, DNS & HTTP

Step-by-step conceptual walkthroughs with worked GATE numericals.

Open YouTube↗
Neso Academy · Computer Networks Series↗Instructor: Neso Academy · Covers: Data link layer, framing, error detection, medium access, TCP/IP

Clear whiteboard lectures for foundational and semester exam coverage.

Open YouTube↗