NivaarExam PrepOfficial exam papers ↗

22-Elec-B4 Information Technology Networks · May 2017

Question 2 of 5: Transport Layer Protocols

Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)

Notes on this paper

Paper format. Engineers Canada / Professional Engineers of Ontario, National Examinations — May 2017, 16-Elec-B4 Information Technology Networks. Three hours, closed book, one approved Casio or Sharp calculator permitted. Five questions of 25 marks each; any four constitute a complete paper worth 100 marks, and the marks are printed in the left margin against every sub-part. All five questions are solved here, because this set is a study resource rather than an exam attempt.

Reference texts.

Canadian context. The spectrum, licensing and equipment-certification framework assumed throughout is the Canadian one: Innovation, Science and Economic Development Canada (ISED) licenses the cellular bands under the Radiocommunication Act and publishes the Standard Radio System Plans (SRSP) that fix the duplex spacing referred to in Question 1(e), and Canadian carriers deploy the same 3GPP LTE numerology used in Question 1(b).

Question 2: Transport Layer Protocols (25 marks)

Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.

Part (a) — TCP or UDP for video streaming over a mobile wireless link? For a live or interactive stream the answer is UDP, carrying RTP and a codec that tolerates loss. The reasoning turns on what the two transports do when a packet goes missing. TCP guarantees an ordered, complete byte stream, which it achieves by retransmitting; on a mobile link a retransmission costs at least one round-trip time, and the replacement frame arrives after its playout instant has passed, so it is useless to the decoder while simultaneously stalling every packet queued behind it — head-of-line blocking. Worse, as part (c) develops, TCP interprets a fading loss as congestion and halves its rate, so the picture quality falls at exactly the moment the radio channel recovers. UDP simply delivers what arrives: a lost slice degrades one macroblock region for a few frames, the decoder conceals it, and the stream keeps its timing.

The engineering trade is therefore timeliness against fidelity, and video is one of the few applications that prefers timeliness. The application must then supply what UDP does not: RTP sequence numbers and timestamps for reordering and jitter removal, a de-jitter buffer of 100–300 ms, forward error correction or a scalable codec layer for resilience, and RTCP feedback so the sender can rate-adapt — because an application that ignores congestion signals is not welcome on a shared network. The honest qualification: stored, non-interactive streaming (Netflix, YouTube) does the opposite and runs adaptive-bitrate HTTP over TCP, because a buffer of tens of seconds absorbs retransmission delay and fidelity then matters more than latency. The deciding question is the size of the playout buffer relative to the round-trip time.

Part (b) — why end-to-end congestion control is necessary when links differ in capacity. A packet network offers no admission control: a source may emit at any rate its own interface allows, and every router it traverses absorbs the mismatch in a finite buffer. Where capacities differ, the mismatch is structural rather than accidental, and only the end systems — which alone know the whole path — can resolve it.

Example. Two hosts, A and B, each attached by 1 Gbit/s Ethernet to a router R, which reaches the destination network over a single 10 Mbit/s wide-area link with a 250-packet buffer. A begins a bulk transfer and, without congestion control, sends at its line rate. R can drain only 10 Mbit/s, so the buffer fills in a few milliseconds and the queue then discards a hundred packets for every one it forwards. Three things now happen, and each of them is the reason end-to-end control exists:

With end-to-end control the first losses (or ECN marks) reach A within one round-trip time, A halves its congestion window, and the sending rate converges on the fair share of the 10 Mbit/s bottleneck. The general principle is that the bottleneck may be any link on the path, may change during the connection, and is invisible to every node except the ones that can measure the path end to end — which is the argument for placing the control loop in the transport layer.

Part (c) — why TCP is suboptimal over a wireless link. TCP's congestion control rests on one inference: that a lost segment means a full queue somewhere on the path. That inference was sound when the only lossy element was a router buffer, and it is false on a radio link, where the multipath fading of Question 1(d) destroys frames while every queue on the path is empty. TCP cannot tell the two apart — both present as a missing acknowledgement — so it applies the congestion remedy to a corruption problem: on three duplicate ACKs it halves the congestion window and the slow-start threshold; on a timeout it collapses the window to one segment and restarts slow start.

The penalty is severe and self-reinforcing. Throughput falls just when the channel is recovering, so the connection under-uses a link that is once again perfectly good; the loss rate seen by TCP is far higher than the residual rate a wired path would show, and since steady-state throughput varies roughly as $1/\sqrt{p}$ with loss probability $p$, a 1 percent frame-loss rate is enough to cripple a long connection. Recovery is slow because it proceeds one segment per round-trip time in congestion avoidance, and a link that fades every few hundred milliseconds may never leave the low-window region at all. The usual mitigations attack the false inference rather than TCP itself: link-layer ARQ and hybrid ARQ hide residual radio losses from the transport (this is what LTE's RLC layer does), split connections or performance-enhancing proxies terminate TCP at the base station, explicit congestion notification lets routers signal real congestion without dropping, and loss-differentiating or delay-based algorithms — TCP Westwood, Veno, and today BBR — estimate the bottleneck rate directly instead of reading every loss as congestion.

Part (d) — window evolution from 1 to beyond a threshold of 64.

Given. Initial congestion window $cwnd_0 = 1$ segment (MSS); slow-start threshold $ssthresh = 64$ segments; every transmitted segment is acknowledged, so no loss occurs; one window is sent per round-trip time.

Find. The congestion window in each successive transmission round, up to the threshold and beyond it.

Approach. Apply the two growth laws of TCP congestion control in turn — exponential (slow start) while $cwnd < ssthresh$, then linear (congestion avoidance) once the threshold is reached.

  1. Slow start: double the window every round. While $cwnd$ is below $ssthresh$, every acknowledgement increases $cwnd$ by one segment, so a whole window of ACKs doubles it: $$cwnd_{k+1} = 2\,cwnd_{k}, \qquad cwnd < ssthresh.$$ Starting from one segment the window therefore takes the values 1, 2, 4, 8, 16, 32, 64 in transmission rounds 1 to 7.
  2. Identify the round at which the threshold is met. Since $cwnd_{k} = 2^{\,k-1}$ during slow start, the threshold is reached when $2^{\,k-1} = 64$, that is $$k = 1 + \log_2 64 = \boxed{\text{round } 7,\ cwnd = 64 \text{ segments}}$$ By that point $1+2+4+8+16+32+64 = 127$ segments have been sent, so the exponential phase costs only seven round-trip times to reach a large window.
  3. Congestion avoidance: add one segment per round. At and beyond the threshold TCP switches to additive increase, raising $cwnd$ by one MSS per round-trip time (each ACK contributes $1/cwnd$): $$cwnd_{k+1} = cwnd_{k} + 1, \qquad cwnd \ge ssthresh.$$ The window therefore continues 65 in round 8, 66 in round 9, and so on, probing for the path capacity gently instead of doubling into it.

Written out, the example asked for is:

Round: 1  2  3  4  5  6  7  8  9  —  cwnd: 1  2  4  8  16  32  64  65  66

12345678916334966Transmission round (window)Congestion window (segments)cwnd, no loss
Figure 2(d). Congestion window against transmission round with no loss. The window doubles through slow start, meets the dashed threshold of 64 segments in round 7, and then grows by one segment per round in congestion avoidance.

Part (e) — the same example with a loss in the fourth window.

Check: which part is to be repeated. The printed question says “Repeat part b”, but part (b) contains no window example to repeat, whereas part (d) does, and the added conditions (“a packet in the fourth window is not acknowledged, and TCP enters slow start”) only make sense applied to it. It is read here as repeat part (d). The data of part (d) — initial window 1, threshold 64, one window per round — are carried over unchanged.

Given. $cwnd_0 = 1$ segment; initial $ssthresh = 64$ segments; a segment sent in the fourth window is lost, and the loss is discovered by retransmission timeout, so TCP re-enters slow start.

Find. The window sequence before and after the loss, identifying the new threshold and the point at which growth becomes linear.

Approach. Grow the window exponentially to the fourth round, apply the multiplicative decrease that a timeout triggers, then repeat the two growth laws against the new threshold.

  1. Grow to the fourth window. Slow start is unaffected until the loss, so rounds 1 to 4 carry windows of $$cwnd = 1,\ 2,\ 4,\ 8 \text{ segments,}$$ and the segment that goes missing is one of the eight sent in round 4.
  2. Apply multiplicative decrease at the loss. The retransmission timer expires before the missing acknowledgement arrives. TCP records half the window in flight as the new threshold and restarts from one segment: $$ssthresh_{new} = \frac{cwnd_{loss}}{2} = \frac{8}{2} = \boxed{4 \text{ segments}}, \qquad cwnd \leftarrow 1 \text{ segment.}$$ The lost segment is retransmitted, and the original threshold of 64 is discarded — the network has just demonstrated that 64 was optimistic.
  3. Slow start again, against the new threshold. Exponential growth resumes from one segment but now stops much sooner, at the new threshold: rounds 5, 6 and 7 carry $$cwnd = 1,\ 2,\ 4 \text{ segments,}$$ so slow start lasts only three rounds instead of seven.
  4. Congestion avoidance from the new threshold. With $cwnd = ssthresh = 4$ the algorithm switches to additive increase, giving 5, 6, 7 segments in rounds 8, 9 and 10: $$cwnd_{k+1} = cwnd_{k} + 1 \quad\text{for } cwnd \ge 4.$$ Twelve rounds after the loss — at round 16 — the window has recovered only to 13 segments, against the 64 the loss-free run of part (d) reached in seven — the cost of a single lost packet.

The complete example is:

Round: 1  2  3  4  5  6  7  8  9  10  —  cwnd: 1  2  4  8 (loss)  1  2  4  5  6  7

The features of TCP the question asks to be illustrated are all visible in that sequence: slow start (rounds 1–4 and 5–7, exponential); the slow-start threshold as the boundary between the two growth laws, and its adaptation from 64 to 4; multiplicative decrease at the loss and additive increase afterwards, the AIMD pair that makes TCP converge to a fair share; timeout-based loss detection, which is what forces the window all the way back to one; and self-clocking, since each round advances only when the previous window's acknowledgements return.

Check: timeout versus fast retransmit. The question states that TCP enters slow start, which is the response to a retransmission timeout, so the window is taken back to one segment as above. Had the loss instead been detected by three duplicate acknowledgements, TCP Reno's fast retransmit and fast recovery would set both $ssthresh$ and $cwnd$ to 4 and continue in congestion avoidance from there — sequence 1, 2, 4, 8, 4, 5, 6, 7 — without the return to one. Both readings share the same new threshold of 4.

1234567891016324864Transmission round (window)Congestion window (segments)cwnd, loss in window 4
Figure 2(e). The same connection with a segment lost in the fourth window (circled). The timeout drops the window to one segment and the threshold from 64 to 4, so the second slow start ends after three rounds and growth becomes linear from round 8.
Final results — Question 2
QuantitySymbol / whereValue
Window sequence, no loss (rounds 1–9)Q2(d)1, 2, 4, 8, 16, 32, 64, 65, 66
Round at which cwnd reaches the thresholdQ2(d)round 7
Segments sent in the first 7 roundsQ2(d)127
Window at the loss$cwnd_{loss}$, Q2(e)8 segments
New slow-start threshold after the loss$ssthresh_{new}$, Q2(e)4 segments
Window sequence with loss (rounds 1–10)Q2(e)1, 2, 4, 8, 1, 2, 4, 5, 6, 7
Transport chosen for live wireless videoQ2(a)UDP (with RTP/RTCP)