NivaarExam PrepOfficial exam papers ↗

22-Elec-B4 Information Technology Networks · December 2015

Question 3 of 5: The transport layer (25 marks)

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

Notes on this paper

Paper format. Professional Engineers of Ontario, Annual Examinations — December 2015, 07-Elec-B4 Information Technology Networks. Three hours, closed book, a PEO-approved non-programmable calculator permitted. Five questions; any four constitute a complete paper worth 100 marks, and marks are printed in the left margin against each sub-part. All five questions are solved here, because the set is a study resource rather than an exam attempt.

Reference texts.

Question 3 — The transport layer (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.

Given. An initial congestion window $\mathrm{cwnd}_{1}=1$ MSS and a congestion threshold $\mathrm{ssthresh}=32$ MSS; in part (c) every segment is acknowledged, and in part (d) a segment in the third window is not. Find. The major behavioural differences between TCP and UDP with an application suited to each, and the congestion window used in each transmission round for both the loss-free and the lossy case.

Part (a) — Major differences between TCP and UDP

Both protocols sit on IP and both multiplex applications by port number, and there the resemblance stops. The differences that matter fall into four groups.

TCP and UDP compared
AspectTCPUDP
ConnectionConnection-oriented: a three-way handshake establishes state at both ends before any data flows, and a four-way exchange tears it downConnectionless: a datagram is sent with no prior exchange and no per-peer state
Service modelReliable, in-order byte stream; segment boundaries are not preservedBest-effort message service; datagram boundaries are preserved, delivery is not
Error recoverySequence numbers, cumulative acknowledgements, timeouts, fast retransmit and duplicate detectionAn optional checksum, which discards a corrupt datagram; nothing is retransmitted
Flow controlReceiver-advertised window prevents a fast sender overrunning a slow receiverNone
Congestion controlSlow start and AIMD congestion avoidance; the sender slows down when the network signals lossNone — the sender transmits at whatever rate the application chooses
Header20 bytes minimum, more with options8 bytes fixed
AddressingStrictly unicast, point-to-pointSupports unicast, multicast and broadcast
Delay behaviourVariable: retransmission and head-of-line blocking add unbounded jitterLow and predictable: a datagram is delivered once or not at all

The single sentence that captures it: TCP trades latency and complexity for reliability and network friendliness, while UDP trades reliability away to keep latency and overhead minimal, leaving any recovery to the application.

Part (b) — An application suited to each

Better with TCP: bulk file transfer — for example, nightly upload of a plant historian archive over SFTP. Every byte must arrive and arrive in order, because a single missing block corrupts the archive; the transfer has no deadline, so the delay introduced by a retransmission costs nothing; and the file is large enough that TCP's congestion control is doing genuinely useful work in sharing the link fairly with other traffic. Web pages, email and remote login belong to the same class for the same reasons.

Better with UDP: real-time voice — for example, a VoIP call carried in RTP over UDP. Here a retransmitted packet is worse than useless: by the time it arrives the play-out instant for that 20 ms of speech has passed, so it can only be discarded, having consumed bandwidth and possibly delayed the packets behind it. The codec conceals an isolated lost packet far better than the listener tolerates a gap, so a small loss rate is preferable to variable delay. UDP's absence of congestion control is also the point: a voice codec produces a constant rate and cannot usefully be slowed down. DNS is a second good example for a different reason — a single short request and reply would spend three round trips on a TCP handshake for one round trip of useful work, so the application retries instead.

It is worth noting that QUIC now blurs this line by rebuilding reliability, congestion control and encryption on top of UDP in user space, precisely so that it can keep UDP's freedom from head-of-line blocking while regaining TCP's guarantees.

Part (c) — Evolution of the congestion window up to and beyond the threshold

Approach. TCP grows the congestion window in two regimes: exponentially in slow start while $\mathrm{cwnd}\lt\mathrm{ssthresh}$, and linearly in congestion avoidance once the threshold is reached.

  1. Apply the slow-start rule. In slow start the sender increases cwnd by one MSS for every segment acknowledged, so a whole window of acknowledgements doubles the window once per round-trip time: $$\mathrm{cwnd}_{n}=2^{\,n-1}\ \text{MSS}\qquad\text{while}\qquad \mathrm{cwnd}\lt\mathrm{ssthresh}.$$ Starting from $\mathrm{cwnd}_{1}=1$ this gives 1, 2, 4, 8, 16, 32 segments.
  2. Find the round at which the threshold is met. Setting $2^{\,n-1}=32$ gives $n-1=5$, so $$\boxed{\mathrm{cwnd}=\mathrm{ssthresh}=32\ \text{MSS at the 6th transmission round}}$$ Slow start therefore lasts six round-trip times, during which the sender delivers $1+2+4+8+16+32=63$ segments.
  3. Switch to congestion avoidance. Once cwnd reaches the threshold TCP becomes cautious, increasing the window by roughly one MSS per round-trip time rather than doubling it — implemented as an increment of $\mathrm{MSS}^{2}/\mathrm{cwnd}$ per acknowledgement, which accumulates to one MSS over a full window: $$\mathrm{cwnd}_{n}=32+(n-6)\ \text{MSS}\qquad\text{for}\qquad n\ge6.$$ The windows therefore continue 33, 34, 35, 36 and so on, one segment larger each round.
  4. Tabulate the example. Collecting both regimes gives the requested worked example, which is the answer the marker is looking for.
Congestion window with no loss (part c)
Transmission round12345678910
cwnd (MSS)1248163233343536
Phaseslow start (doubling)congestion avoidance (+1 per RTT)

Part (d) — Congestion window when the third window is not fully acknowledged

Check: the printed question says “the same setup as in part b”, but part (b) states no numerical setup. The setup being referred to is plainly that of part (c) — initial window 1 MSS, threshold 32 MSS — and the solution is worked on that basis.

The third window carries $\mathrm{cwnd}_{3}=4$ segments, and one of them goes unacknowledged. TCP treats the loss as the network's congestion signal and responds in two parts: it remembers half the window that was in flight as the new threshold, and it restarts growth from the bottom.

  1. Set the new threshold from the window in flight. The multiplicative-decrease rule halves the window that was outstanding when the loss occurred: $$\mathrm{ssthresh}_{\text{new}}=\max\!\left(2,\ \left\lfloor\frac{\mathrm{cwnd}_{3}}{2}\right\rfloor\right)=\max\!\left(2,\ \left\lfloor\frac{4}{2}\right\rfloor\right)=2\ \text{MSS}.$$ The floor of two segments is what the standard imposes so that the connection never stalls entirely.
  2. Reset the window and restart slow start. In TCP Tahoe, and in TCP Reno when the loss is detected by a retransmission timeout rather than by duplicate acknowledgements, the sender collapses to $$\mathrm{cwnd}_{4}=1\ \text{MSS}$$ and re-enters slow start. Rounds 4 and 5 therefore carry 1 and 2 segments.
  3. Hand over to congestion avoidance at the new threshold. The window reaches the new $\mathrm{ssthresh}=2$ in round 5, so from round 6 onwards growth is linear again: 3, 4, 5 segments.
  4. Collect the eight windows. Reading rounds 1 to 8 in order gives $$\boxed{\mathrm{cwnd}=1,\ 2,\ 4,\ 1,\ 2,\ 3,\ 4,\ 5\ \text{MSS}}$$ the fourth entry being the collapse caused by the loss in the third window.

Had the loss instead been signalled by three duplicate acknowledgements, TCP Reno would have used fast retransmit and fast recovery: it would set both the threshold and the window to 2 MSS and continue in congestion avoidance without a slow-start restart, giving 1, 2, 4, 2, 3, 4, 5, 6. Either answer is defensible provided the variant is stated; the Tahoe sequence above is the one implied by a course that introduces a single “congestion threshold” and a reset to one segment.

123456789109182736Transmission round (window)Congestion window (segments)no loss (Q3c)loss in window 3 (Q3d)
Congestion window against transmission round. The dashed line is the threshold of 32 MSS; the ringed point is the loss in the third window, after which the threshold falls to 2 MSS and slow start restarts.
Question 3 — final results
QuantityValue
Rounds of slow start before the threshold6 (cwnd = 1, 2, 4, 8, 16, 32)
Segments delivered during slow start63
Windows beyond the threshold33, 34, 35, 36, … (+1 MSS per RTT)
New threshold after the loss2 MSS
First eight windows, loss in window 3 (Tahoe)1, 2, 4, 1, 2, 3, 4, 5 MSS
Same case under Reno fast recovery1, 2, 4, 2, 3, 4, 5, 6 MSS
Application better on TCP / UDPbulk file transfer / real-time voice over RTP