CS Atlas GATE 2027
Computer Networks course
0 / 90 complete

Computer Networks/Phase 4 · Transport Layer (TCP)

Lesson 4.2.2 · Item 63 of 90

Sliding window protocols, pipelining & k-bit sequence numbers

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

On this page

Recall warm-up

  1. In Stop-and-Wait ARQ with a = 4, what fraction of each cycle is the sender actually transmitting data?
    Stuck? Peek at 4.2.1 Stop-and-Wait ARQ, 1-bit sequence numbers & link utilisation
    • 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).

    Read lesson 4.2.1

  2. What is the Bandwidth-Delay Product (BDP) of a link?
    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 many distinct values can a k-bit binary field represent?
    Stuck? Peek at 0.2.4 Exponents, logarithms and basic probability
    • 2ᵃ·2ᵇ = 2ᵃ⁺ᵇ; 2¹⁰ ≈ 10³ (estimates only).
    • log₂ x = power of 2 giving x; bits for N values = ⌈log₂ N⌉.
    • P(none) = (1−p)ⁿ · P(≥ 1) = 1 − (1−p)ⁿ · P(exactly 1) = n·p·(1−p)ⁿ⁻¹.
    • (1 − 1/n)ⁿ → 1/e ≈ 0.368; 1/(2e) ≈ 0.184.
    • 1 + 2 + … + 2ᵏ⁻¹ = 2ᵏ − 1; expected tries = 1/p.

    Read lesson 0.2.4

The Hook

In Lesson 4.2.1, when Tt = 2 ms and 2·Tp = 18 ms (cycle = 20 ms), our sender transmitted for 2 ms and sat idle for 18 ms. Notice that 20 ms / 2 ms = 10 packets could have fit back-to-back inside that 20 ms cycle!

Pipelining lets the sender transmit up to N packets back-to-back without waiting for an ACK. A sliding window of size N tracks which packets are currently in flight and slides forward every time an ACK arrives.

Predict First

In our example where 1 cycle is Tt + 2·Tp = 2 + 18 = 20 ms (so 1 + 2a = 10), what is the link utilisation if the sender window size is N = 5 packets? What if N = 10 packets? What if N = 15 packets?

,

• For N = 5: sender transmits for 5 × 2 = 10 ms out of every 20 ms cycle → η = 5/10 = 50%.
• For N = 10: the first ACK returns at t = 20 ms, right as the 10th packet finishes transmitting → η = 10/10 = 100%!
• For N = 15: the link is already 100% busy (utilisation can never exceed 100%) → η = min(1, 15/10) = 100%!

Core Concept

Pipelining & the Sliding Window Utilisation Formula

A sliding-window protocol allows the sender to have up to N (also written Ws) unacknowledged packets in flight simultaneously. In one cycle of duration Tt + 2·Tp, the sender can transmit N packets (taking N · Tt time):

Sliding-Window Link Utilisation (Efficiency):
η = min( 1, (N · Tt) / (Tt + 2·Tp) ) = min( 1, N / (1 + 2a) ), where a = Tp / Tt.
Minimum window size for 100% (full) utilisation:
N_opt = ⌈1 + 2a⌉ = ⌈(Tt + 2·Tp) / Tt⌉.
Stop & Wait (N=1)
P1Idle (wait ACK)P2
Window N=4 (η=40%)
P1P2P3P4IdleP5
Window N=10 (η=100%)
P1P2P3P4P5P6P7P8P9P10P11
05101520
time (ms)
Comparing N = 1 (10%), N = 4 (40%), and N = 10 (100% continuous transmission!) when Tₜ = 2 ms and 2·Tₚ = 18 ms.

Sender Window (Ws) and Receiver Window (Wr)

Both endpoints maintain a window over the sequence number space:

  • Sender Window (Ws = N): The range of sequence numbers the sender has transmitted (or is allowed to transmit) that are not yet acknowledged. When the oldest packet in the window is ACKed, the window's left and right edges slide forward.
  • Receiver Window (Wr): The range of sequence numbers the receiver is willing to accept and buffer:
    — If Wr = 1, the receiver accepts packets strictly in order (Go-Back-N, 4.2.3).
    — If Wr > 1, the receiver can buffer out-of-order packets until the missing gap arrives (Selective Repeat, 4.2.4).
012345670123ACKed & deliveredSender Window Ws = 4 (in flight)Not yet sent
A sliding sender window of size Ws = 4 over an 8-number (k = 3 bit) sequence space.

k-bit Sequence Numbers & Wrap-Around Ambiguity

In a header, the sequence number field has a fixed width of k bits, so sequence numbers cycle modulo 2ᵏ: 0, 1, 2, …, 2ᵏ − 1, 0, 1, ….

Critical insight: Can a sender use a window of size Ws = 2ᵏ with k-bit sequence numbers? NO! As we prove in 4.2.3 and 4.2.4, to prevent wrap-around ambiguity between old retransmitted packets and new packets when ACKs are lost, every sliding-window protocol must obey the Fundamental Window Bound:

Fundamental Sliding-Window Rule:
Ws + Wr ≤ 2ᵏ (where k is the number of sequence-number bits).
Go-Back-N (Wr = 1)
Ws + 1 ≤ 2ᵏ ⇒ Ws ≤ 2ᵏ − 1
Selective Repeat (Ws = Wr)
2 · Ws ≤ 2ᵏ ⇒ Ws = Wr ≤ 2ᵏ⁻¹
Both GBN and SR window bounds come from one universal equation: Ws + Wr ≤ 2ᵏ!

Putting it together

  • Pipelining keeps up to N packets in flight at once, boosting link utilisation to η = min(1, N / (1 + 2a)).
  • Full (100%) link utilisation is reached when the window size covers the entire round-trip pipe: N ≥ 1 + 2a.
  • With k-bit sequence numbers (2ᵏ values), sender and receiver windows must satisfy W_s + W_r ≤ 2ᵏ.

Visual

028.2556.584.751131246891012N_opt = 1 + 2a = 9 (100%!)11.122.244.466.788.9100100100Sender Window Size NLink Utilisation η (%)
Utilisation rises linearly as N / (1 + 2a) until N reaches 1 + 2a = 9, where the pipe is 100% full.

Worked Examples

Easy

A link has a = Tp / Tt = 4. What is the link utilisation for a sliding-window protocol with sender window N = 5? What minimum integer window size N achieves 100% utilisation?

Show the full solution

Here 1 + 2a = 1 + 8 = 9.
For N = 5: η = 5 / 9 ≈ 55.6%.
For 100% utilisation: N = 1 + 2a = 9.

Medium

A satellite link has bandwidth B = 1 Mbps and one-way propagation delay Tp = 250 ms. Frames are 1000 bits long. Find Tt, a, and the minimum window size N needed to achieve 100% link utilisation.

Show the full solution

• Tt = 1000 bits / 10⁶ bit/s = 1 ms.
• a = Tp / Tt = 250 / 1 = 250.
• N_opt = 1 + 2a = 1 + 2(250) = 501 frames.

GATE

In the satellite link of Example 2 (where 1 + 2a = 501), suppose the protocol instead wants to achieve at least 50% link utilisation (η ≥ 0.50). What is the minimum sender window size N required?

Show the full solution

We need N / (1 + 2a) ≥ 0.50 → N ≥ 0.50 × 501 = 250.5.
Since window size N must be an integer, N = ⌈250.5⌉ = 251 frames.

GATE Traps

  • Utilisation cannot exceed 1 (100%)! If 1 + 2a = 5 and N = 8, utilisation is 1 (100%), NOT 8/5 = 160%! Always apply min(1, N/(1+2a)).
  • k bits ≠ window size k! A k-bit sequence number field gives 2ᵏ sequence numbers (not k).

Memory Hook

Fill the pipe of length (1 + 2a) with N packets: η = min(1, N / (1 + 2a)), and Ws + Wr ≤ 2ᵏ!

Connect the Dots

Now we have the general sliding-window framework. What happens when Packet #3 in the middle of a window of 8 packets gets lost? Next question (4.2.3): How does Go-Back-N (GBN) handle losses when the receiver refuses to buffer out-of-order packets (Wr = 1)?

Self-Test

  1. NAT

    A link has ratio a = T_p / T_t = 7.5. What is the minimum sender window size N required to achieve 100% link utilisation?

    Write your answer before opening the key.

  2. NAT

    On a link where 1 + 2a = 20, what is the link utilisation (in percent) when a sliding-window protocol uses a sender window of size N = 7?

    Write your answer before opening the key.

  3. MCQ

    What is the universal relationship between sender window size W_s, receiver window size W_r, and a k-bit sequence number field to guarantee no sequence-number ambiguity?

    1. W_s + W_r ≤ k
    2. W_s + W_r ≤ 2ᵏ
    3. W_s × W_r ≤ 2ᵏ
    4. W_s + W_r ≤ 2ᵏ − 1
  4. NAT

    A 4 Mbps link has one-way propagation delay T_p = 10 ms and sends 4000-bit frames. What is the link utilisation (in percent) if the sender window size is N = 25?

    Write your answer before opening the key.

Rule Card

  • Sliding-window utilisation: η = min(1, N / (1 + 2a)); full utilisation at N = ⌈1 + 2a⌉.
  • k-bit sequence space: 0 .. 2ᵏ − 1 (2ᵏ numbers); universal bound: Ws + Wr ≤ 2ᵏ.

Concept Ledger

  • sliding window
  • sender window Ws
  • receiver window Wr
  • k-bit sequence space 0..2ᵏ−1
  • pipelining
  • η = min(1, N/(1+2a))

Answer Vault

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

Warm-up answers

  1. 1 / (1 + 2×4) = 1/9 (about 11.11%).
  2. The number of bits that can be in flight in the pipe across one RTT (2·T_p × B).
  3. 2ᵏ values (from 0 to 2ᵏ − 1).

Self-test answers

  1. 16 — N_opt = 1 + 2a = 1 + 2(7.5) = 16.
  2. 35 — η = N / (1 + 2a) = 7 / 20 = 0.35 = 35%.
  3. B — To prevent overlap between the old window and the new window when ACKs are lost, W_s + W_r ≤ 2ᵏ must hold.
    • A: k bits give 2ᵏ sequence numbers, not k.
    • C: The bound is additive (W_s + W_r ≤ 2ᵏ), not multiplicative.
    • D: W_s + W_r can equal 2ᵏ (in GBN, W_s = 2ᵏ − 1 and W_r = 1 sum to 2ᵏ).
  4. 100 — T_t = 4000 / (4 × 10⁶) = 1 ms → a = 10 / 1 = 10 → 1 + 2a = 21. Since N = 25 ≥ 21, η = min(1, 25/21) = 1 = 100%.

Flashcards

  1. Formula for sliding-window link utilisation with window size N?
    Reveal answerη = min(1, N / (1 + 2a)), where a = T_p / T_t.
  2. Minimum window size N for 100% link utilisation?
    Reveal answerN = ⌈1 + 2a⌉ = ⌈(T_t + 2·T_p) / T_t⌉.
  3. State the universal window bound connecting W_s, W_r, and k.
    Reveal answerW_s + W_r ≤ 2ᵏ.

Exam shortcuts

  • Universal Window Bound Ws + Wr ≤ 2ᵏ: Memorise this ONE inequality and plug in Wr = 1 for GBN (Ws ≤ 2ᵏ − 1) or Wr = Ws for SR (Ws ≤ 2ᵏ⁻¹)! — never mixing up the GBN and SR window size formulas.
  • Target Utilisation Window Formula: To reach target efficiency η_target, minimum integer window is N = ⌈η_target × (1 + 2a)⌉. — GATE NAT questions asking for window size or bits for 50%, 80%, or 100% efficiency.

Ready for the next idea?

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