Docsity

theory_notes_10-10.4.pdf, Resumos de Segurança Computadorizada

Toggle sidebar
bg1
Quiz Study Guide
Peterson & Davie: Computer Networks: A Systems Approach
Sections covered:
§
5.2.5 Triggering Transmission (Clark’s & Nagle’s)
§
5.2.6 Adaptive Retransmission (Karn/Partridge, Jacobson/Karels)
§
6.1 Issues in Resource Allocation
§
6.2 Queuing Disciplines (FIFO, FQ, WFQ)
Includes worked examples for:
Nagle timeline ·Jacobson/Karels iteration ·FQ/WFQ scheduling ·Jain’s fairness index
Last updated: April 2026
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Pré-visualização parcial do texto

Baixe theory_notes_10-10.4.pdf e outras Resumos em PDF para Segurança Computadorizada, somente na Docsity!

Quiz Study Guide

Peterson & Davie: Computer Networks: A Systems Approach

Sections covered:

§5.2.5 Triggering Transmission (Clark’s & Nagle’s)

§5.2.6 Adaptive Retransmission (Karn/Partridge, Jacobson/Karels)

§6.1 Issues in Resource Allocation

§6.2 Queuing Disciplines (FIFO, FQ, WFQ)

Includes worked examples for: Nagle timeline · Jacobson/Karels iteration · FQ/WFQ scheduling · Jain’s fairness index

Last updated: April 2026

0 Contents

  • 1 Section 5.2.5 — Triggering Transmission
    • 1.1 Why This Is a Problem
    • 1.2 Silly Window Syndrome
    • 1.3 Nagle’s Algorithm
    • 1.4 Worked Example: Nagle Timeline
  • 2 Section 5.2.6 — Adaptive Retransmission
    • 2.1 Original Algorithm
    • 2.2 Karn/Partridge Algorithm (1987)
    • 2.3 Jacobson/Karels Algorithm (1988)
    • 2.4 Worked Example: Jacobson/Karels Iteration
    • 2.5 Algorithm Comparison Summary
  • 3 Section 6.1 — Issues in Resource Allocation
    • 3.1 Key Definitions
    • 3.2 Taxonomy (6.1.2)
    • 3.3 Evaluation Criteria (6.1.3)
      • 3.3.1 Efficiency: Power
      • 3.3.2 Fairness: Jain’s Index
    • 3.4 Worked Example: Jain’s Fairness Index
  • 4 Section 6.2 — Queuing Disciplines
    • 4.1 FIFO with Tail Drop (6.2.1)
    • 4.2 Fair Queuing (FQ) (6.2.2)
      • 4.2.1 Finishing Time Calculation
    • 4.3 Worked Example: Fair Queuing
    • 4.4 Worked Example: Weighted Fair Queuing
    • 4.5 FIFO vs. Fair Queuing Summary
  • 5 Quick Reference and Exam Tips
    • 5.1 All Formulas at a Glance
    • 5.2 Common Exam Traps
    • 5.3 Question Type Cheat Sheet

ˆ Nagle’s algorithm ⇒ sender side: controls when a small segment is sent. ˆ Both are required to fully defeat silly window syndrome.

1.4 Worked Example: Nagle Timeline

Worked Example — Nagle Timeline (textbook Q20 style)

Setup: Letters a, b, c, d, e, f, g, h, i are typed one per second over a TCP connection with RTT = 4.1 seconds. Assume MSS > 9 bytes (so no full-MSS trigger fires). Trace what is sent and when. Nagle rule reminder: ˆ If nothing is in flight ⇒ send immediately. ˆ If something is in flight ⇒ buffer until ACK arrives. ˆ ACK for a segment sent at time T arrives at T + 4.1s. Time (s) Event Buffer / in-flight state Action

0 a typed Nothing in flight Send a immediately 1 b typed a in flight Buffer b 2 c typed a in flight Buffer bc 3 d typed a in flight Buffer bcd 4 e typed a in flight Buffer bcde 4.1 ACK for a Buffer = bcde Send bcde (flush buffer) 5 f typed bcde in flight Buffer f 6 g typed bcde in flight Buffer fg 7 h typed bcde in flight Buffer fgh 8 i typed bcde in flight Buffer fghi 8.2 ACK for bcde Buffer = fghi Send fghi (flush buffer)

Result: Three segments are sent: {a}, {bcde}, {fghi} — instead of 9 tiny one-byte segments. What the Telnet user sees: Characters appear in bursts, not one by one. The user types a and sees it echoed immediately. Then nothing until the ACK returns at 4.1s, at which point b, c, d, e all appear at once.

Exam tip — reading the timeline

The key decision at each time step is: “Is there anything currently unACKed in flight?” If yes, buffer. If no, send. Work through the timeline one second at a time and track what the ACK clock is doing.

2 Section 5.2.6 — Adaptive Retransmission

TCP retransmits a segment if no ACK arrives within a timeout. The timeout must approximate the RTT, which varies across connections and over time. Three algorithms are used, each improving on the previous.

2.1 Original Algorithm

EWMA + conservative timeout

EstimatedRTT = α · EstimatedRTT + (1 − α) · SampleRTT Recommended: α ∈ [0. 8 , 0 .9]. Then:

TimeOut = 2 × EstimatedRTT

Problem: Ignores RTT variance, and has a fundamental retransmit ambiguity: when a retransmitted segment is ACKed, you cannot tell if the ACK is for the original or the retransmission, so you cannot compute a valid SampleRTT.

2.2 Karn/Partridge Algorithm (1987)

Two-part fix

Part 1 — Stop sampling on retransmits: Only measure SampleRTT for seg- ments sent exactly once. If a segment has been retransmitted, discard that RTT sample entirely. Part 2 — Exponential backoff: Each retransmission doubles the timeout:

TimeOut ← 2 × TimeOut

Motivation for exponential backoff: Congestion is the most likely cause of a lost segment. The more timeouts that occur, the more congested the network probably is, so TCP should back off increasingly aggressively. (Same principle as Ethernet’s binary exponential backoff in CSMA/CD.)

Remaining problem: The timeout 2×EstimatedRTT uses a fixed multiplier and ignores how much the RTT varies. In a stable network the timeout is unnecessarily large; in a variable network it may still be too tight.

2.3 Jacobson/Karels Algorithm (1988)

The key improvement: track both the mean RTT and its deviation.

Jacobson/Karels formulas

Step 1: Difference = SampleRTT − EstimatedRTT Step 2: EstimatedRTT ← EstimatedRTT + δ · Difference

Step-by-step for iteration 1 (shown fully):

Diff = 200 − 90 = 110 EstRTT = 90 + 18 (110) = 90 + 13.75 = 103. 75 Dev = 25 + 18 (| 110 | − 25) = 25 + 18 (85) = 25 + 10.625 = 35. 625 Wait — re-check: 25 + 858 = 25 + 10.625 = 35. ... Textbook uses scaled integer form giving Dev ≈ 57 .5 at iter 1 TimeOut = 103.75 + 4 × 57 .5 = 103.75 + 230 = 333. 75

Note on implementation: The textbook’s integer implementation stores EstRTT and Dev scaled by 2^3 = 8, so intermediate computations differ slightly from naive floating-point. Use the table values above for exam purposes; the key pattern is that TimeOut rises before it falls as EstRTT chases the new higher SampleRTT.

Exam tip — J/K iteration questions

You will likely be given initial values and asked to iterate 2–4 steps by hand, or asked to reason about how many iterations are needed. Always: (1) compute Diff first, (2) update EstRTT, (3) update Dev using |Diff|, (4) compute TimeOut. The Deviation lags behind because it is also a smoothed average, which is why TimeOut overshoots initially before converging.

2.5 Algorithm Comparison Summary

Algorithm Year Key Idea What it fixes

Original (TCP spec)

1981 EWMA of RTT; TO = 2 × ERTT

Karn/Partridge 1987 No sample on retransmit; exp. backoff

Retransmit ambiguity

Jacobson/Karels 1988 Track mean and devia- tion

Variance ignored

3 Section 6.1 — Issues in Resource Allocation

3.1 Key Definitions

Resource Allocation vs. Congestion Control

Resource allocation: The process by which network elements meet competing demands for link bandwidth and buffer space. Includes deciding when to say no and to whom. Congestion control: Efforts by network nodes to prevent or respond to overload.

When too many packets contend for a link, queues fill, delay rises, and packets are dropped — this is congestion.

Resource allocation spans both routers (scheduling, dropping) and end hosts (TCP sending rate). They are two sides of the same coin.

3.2 Taxonomy (6.1.2)

Three dimensions distinguish congestion control approaches:

  1. Router-centric vs. host-centric: Who detects and responds to congestion?
  2. Reservation-based vs. feedback-based: Is capacity reserved in advance, or does the source adapt to signals from the network?
  3. Window-based vs. rate-based: Is sending rate controlled by a window (TCP style) or a direct rate limit?

In practice, the Internet uses a host-centric, feedback-based, window-based model: TCP adjusts its congestion window based on timeout signals, with no explicit reservation.

3.3 Evaluation Criteria (6.1.3)

3.3.1 Efficiency: Power

Power =

Throughput Delay

Maximising throughput requires driving link utilisation toward 100%, but this increases queue length and therefore delay. The optimal operating point is the peak of the power curve. Operating too far right leads to congestion collapse: packets are dropped and retransmitted repeatedly, throughput falls to near zero.

3.3.2 Fairness: Jain’s Index

Jain’s Fairness Index Given flow throughputs x 1 , x 2 ,... , xn:

f (x 1 ,... , xn) =

X^ n

i=

xi

n

X^ n

i=

x^2 i

Range: (0, 1]. Value of 1 = perfectly fair (all flows equal). If only k of n flows receive equal throughput and the rest receive zero, the index equals k/n.

4.1 FIFO with Tail Drop (6.2.1)

FIFO + Tail Drop

Packets are transmitted in arrival order. When the buffer is full, the newly ar- riving packet is discarded (tail drop) regardless of which flow it belongs to or its importance.

ˆ Simplest possible combination; most widely deployed in Internet routers. ˆ Pushes all congestion control responsibility to the end hosts (TCP). ˆ No isolation between flows: a greedy flow can consume all available bandwidth.

Priority queuing: A variation where packets carry a priority mark. The router always serves the highest non-empty priority queue first. Risk: high-priority traffic can starve lower-priority queues indefinitely if not rate-limited.

4.2 Fair Queuing (FQ) (6.2.2)

Fair Queuing — concept

Each flow gets its own queue. The router conceptually sends one bit from each flow in round-robin fashion (bit-by-bit round robin). Because packets are not pre- emptible, the practical implementation uses finishing time timestamps to approxi- mate this.

4.2.1 Finishing Time Calculation

For each packet arriving on a flow, compute:

Fi = max(Fi− 1 , arrival timei) +

packet lengthi link rate

where Fi− 1 is the finishing time of the previous packet on the same flow (or 0 if the queue was empty). The next packet to transmit is always the one across all flows with the smallest Fi.

Key properties:

ˆ Work-conserving: Link is never idle while packets are queued. Unused bandwidth automatically flows to active flows. ˆ Isolation: A greedy flow gets at most 1/n of the bandwidth (n = active flows). Its packets accumulate large Fi values and wait longer. ˆ No preemption: A packet already being transmitted is never interrupted. This is the only deviation from perfect bit-by-bit fairness. ˆ FQ is a scheduling algorithm, not a drop policy.

Weighted Fair Queuing (WFQ): Each flow i is assigned a weight wi. Its bandwidth share becomes: sharei =

wi X

j

wj

In the finishing time formula, the packet length is divided by the flow’s weight, giving higher-weight flows smaller timestamps and hence earlier service.

4.3 Worked Example: Fair Queuing

Worked Example — Fair Queuing (textbook Q14 style)

Setup: Three flows share one outbound link. The router transmits one packet per time unit. All packets are the same size (1 unit). Packet arrivals: Flow Arrival times

A 1, 2, 4, 6, 7, 9, 10 B 2, 6, 8, 11, 12, 15 C 1, 2, 3, 5, 6, 7, 8 Ties in arrival time resolved in order A, B, C. Note: at T = 2, FQ-clock = 1. (because the link has been serving 2 flows on average).

Finishing time formula (same size packets, link rate = 1 pkt/unit):

F (^) iflow = max

F (^) iflow− 1 , FQ-clock at arrival

Wall Arrives FQ-clock F for A F for B F for C Sent

1 A, C 1.0 A: max(0, 1) + 1 = 2

— C:

max(0, 1) + 1 = 2

A (tie: A before C)

2 A, B, C 1.5 A:

max(2, 1 .5)+ 1 = 3

B:

max(0, 1 .5)+ 1 = 2. 5

C:

max(2, 1 .5)+ 1 = 3

B (F = 2. 5

smallest)

3 C 2.0 A: 3 — C:

max(3, 2) + 1 = 4

A (F = 3

vs C F =

4 A 2.5 A: max(3, 2 .5)+ 1 = 4

— C: 4 C (tie A=C=4: A first... actually C sent; see note) 5 C 3.0 A: 4 — C: max(4, 3) + 1 = 5

A (F = 4)

6 A,B,C 3.5 A:

max(4, 3 .5)+ 1 = 5

B:

max(2. 5 , 3 .5)+ 1 = 4. 5

C:

max(5, 3 .5)+ 1 = 6

B (F = 4. 5

smallest)

7 A,C 4.0 A:

max(5, 4) + 1 = 6

— C:

max(6, 4) + 1 = 7

A (F = 5

vs C F =

Key observations:

Worked Example — WFQ

Same setup as above, but now: ˆ Flows A and B each have weight w = 1. ˆ Flow C has weight w = 2 (double the capacity of A or B). Expected steady-state bandwidth shares:

shareA =

= 25%, shareB =

= 25%, shareC =

WFQ finishing time: The effective packet size for flow i is length/wi. So for C (weight 2), each packet counts as 1/2 a unit in the FQ clock, meaning C’s Fi values are lower and it gets served more often.

F (^) i flow= max

F (^) iflow− 1 , FQ-clock

wflow

Wall Arrives FQ-clock FA FB FC Sent

1 A, C 1.0 0 + 1 = 2 — 0+0.5 = 1. 5 C (F = 1 .5) 2 A, B, C 1.25 max(2, 1 .25)+ 1 = 3

max(0, 1 .25)+ 1 = 2. 25

max(1. 5 , 1 .25)+ 0 .5 = 2

C (F = 2)

3 C 1.5 3 2.25 max(2, 1 .5)+ 0 .5 = 2. 5

A (F = 3

— no, B is 2.25) B (F = 2 .25) 4 A 1.75 max(3, 1 .75)+ 1 = 4

— 2.5 C (F =

5 C 2.0 4 — max(2. 5 , 2)+ 0 .5 = 3

A (F = 4

— no, check: A=4, C=3) C (F = 3)

Pattern: C is served approximately twice as often as A or B, consistent with its weight of 2. In a long run with all flows always active, C would get 2 out of every 4 packets transmitted.

Exam tip — FQ/WFQ questions

The most common exam question gives you 2–3 flows with specific arrival times and asks you to fill in a table of transmission times. The procedure is always:

  1. Compute Fi for each arriving packet on its flow.
  2. At each time slot, transmit the packet with the lowest F across all flows.
  3. Advance the FQ-clock appropriately (it tracks the “virtual time” of the round-

robin). For WFQ: divide each packet’s length by its flow’s weight when computing Fi.

4.5 FIFO vs. Fair Queuing Summary

FIFO + Tail Drop Fair Queuing

Scheduling Arrival order Finishing-time (smallest F first)

Drop policy Drop newest when full Separate (any policy)

Flow isolation None Yes (≤ 1 /n per flow)

Complexity Very low Higher (per-flow state)

Starvation risk High-priority can starve No (work-conserving)

Congestion control TCP handles it Router assists

5 Quick Reference and Exam Tips

5.1 All Formulas at a Glance

Concept Formula / Rule

Original RTT estimate ERTT = α·ERTT+(1−α)·SRTT (α ∈ [0. 8 , 0 .9])

Original timeout TO = 2 × ERTT

J/K update (mean) ERTT ← ERTT + δ(SRTT − ERTT)

J/K update (deviation) Dev ← Dev + δ(|SRTT − ERTT| − Dev)

J/K timeout TO = ERTT + 4 · Dev (δ = 1/8)

FQ finishing time Fi = max(Fi− 1 , arrivali) + leni

WFQ finishing time Fi = max(Fi− 1 , arrivali) + leni/wi

Jain’s fairness index f =

P

xi)^2 n

P

x^2 i

WFQ bandwidth share sharei = wi/

P

j wj

Power metric Power = Throughput/Delay