TCP: Transmission Control Protocol Flashcards

1
Q

Principles of reliable data tranfer

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Reliable data transfer: getting started

A
  • incrementally develop sender, receiver sides of reliable data transfer protocol (rdt)
  • consider only unidirectional data transfer
    • but control info will flow on both directions!
  • use finite state machines (FSM) to specify sender, receiver
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

rdt1.0: reliable transfer over a reliable channel

A
  • underlying channel perfectly reliable
    • no bit errors
    • no loss of packets
  • separate FSMs for sender, receiver:
    • sender sends data into underlying channel
    • receiver reads data from underlying channel
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

rdt2.0: channel with bit errors

A
  • underlying channel may flip bits in packet
    • checksum to detect bit errors
  • the question: how to recover from errors:
    • acknowledgements (ACKs): receiver explicitly tells sender that pkt received OK
    • negative acknowledgements (NAKs): receiver explicitly tells sender that pkt had errors
      • sender retransmits pkt on receipt of NAK
  • new mechanisms in rdt2.0 (beyond rdt1.0):
    • error detection
    • feedback: control msgs (ACK,NAK) from receiver to sender
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

rdt2.0: FSM specification

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

rdt2.0: operation with no errors

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

rdt2.0: error scenario

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

rdt2.0 has a fatal flaw!

A

what happens if ACK/NAK corrupted?
- sender doesn’t know what happened at receiver!
- sender can’t just retransmit: possible duplicate

how can we handle duplicates?
- sender
* retransmits current pkt if ACK/NAK corrupted
* adds sequence number to each pkt

- receiver discards (doesn’ t deliver up) duplicate pkt
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

rdt2.1: outline (sender)

A
  • seq # added to pkt
  • two seq. #’s (0,1) will suffice. Why?
  • must check if received ACK/NAK corrupted
  • twice as many states
    • state must “remember” whether a pkt should have seq # of 0 or 1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

rdt2.1: outline (receiver)

A

§ twice as many states here, too
§ must check if received packet is duplicate
* state indicates whether 0 or 1 is expected pkt seq #

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

rdt2.1: sender, handles garbled ACK/NAKs

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

rdt2.1: receiver, handles garbled ACK/NAKs

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

rdt2.2: a NAK-free protocol

A
  • same functionality as rdt2.1, but using ACKs only
  • instead of NAK, receiver sends ACK for last pkt
    received OK
    • receiver must explicitly include seq # of pkt being ACKed
  • duplicate ACK at sender results in same action as NAK: retransmit current pkt
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

rdt2.2: sender, receiver fragments

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

rdt3.0: channels with errors and loss (new assumption)

A

underlying channel may also lose packets (data, ACKs)
* checksum, seq. #, ACKs, retransmissions will be of help … but not enough

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

rdt3.0: channels with errors and loss (approach)

A

approach: sender waits “reasonable” amount of time for ACK
- retransmits if no ACK received in this time
- if ACK is just delayed (not lost):
* retransmission will be duplicate, but seq. #’ s already handles this
- requires countdown timer

17
Q

rdt3.0 sender

18
Q

rdt 3.0 in action

19
Q

Performance of rdt3.0

A
  • rdt3.0 is correct, but performance stinks
  • transport protocol severely limits potential of
    network!
20
Q

rdt3.0: stop-and-wait operation

21
Q

Pipelined protocols

A

pipelining: sender allows multiple, “in-flight, yet- to-be-acknowledged pkts
* range of sequence numbers must be increased
* buffering at sender and/or receiver

  • two generic forms of pipelined protocols: go-Back-N, selective repeat
22
Q

Pipelining: increased utilization

23
Q

Pipelined protocols: overview (Go-back-N)

A

Go-back-N:
- sender may have up to N unacked packets in pipeline (“window”)

  • receiver only sends cumulative ack
    • doesn’t ack packet if there’ s a gap
  • sender has timer for oldest unacked packet
    • when timer expires, retransmit all unacked
      packets
24
Q

Pipelined protocols: overview (Selective Repeat)

A
  • sender can have up to N unack’ed packets in pipeline
  • rcvr sends individual ack for each packet
  • sender maintains timer for each unacked packet
    • when timer expires, retransmit only that unacked packet)
25
TCP: Overview
- point-to-point: * one sender, one receiver - reliable, in-order byte steam: * no “ message boundaries” - pipelined: * TCP congestion and flow control set window size - full duplex data: * bi-directional data flow in same connection - connection-oriented: * handshaking (exchange of control msgs) inits sender, receiver state before data exchange - flow controlled: * sender will not overwhelm receiver
26
TCP segment structure
27
TCP seq. numbers, ACKs
sequence numbers: * byte stream “index” of first byte in segment’s data acknowledgements: * seq # of next byte expected from other side * cumulative ACK Q: how receiver handles out-of-order segments A: TCP spec doesn’t say, - up to implementor
28
TCP round trip time, timeout Q: how to set TCP timeout value?
- longer than RTT * but RTT varies - too short: premature timeout, unnecessary retransmissions - too long: slow reaction to segment loss
29
TCP round trip time, timeout Q: how to estimate RTT?
- SampleRTT: measured time from segment transmission until ACK receipt * ignore retransmissions - SampleRTT will vary, want estimated RTT “smoother” * average several recent measurements, not just current SampleRTT
30
TCP fast retransmit (a quick example of one TCP optimization)
- time-out period is often relatively long: * so, long delay before resending lost packet - as we know, we detect lost segments via duplicate ACKs. * sender often sends many segments backto-back * if segment is lost, there will likely be many duplicate ACKs.
31
TCP fast retransmit